There are some basic rules to know in understanding how the Windows Installer handles the overwriting of files on the user's system. Here are the rules:
-
If you use the Always Overwrite property of a component to indicate that a file should always be overwritten, the file will always be overwritten on the target machine regardless of the file version, date, or language.
-
If the file being installed has a later version number than the file on the target system, it will replace the existing file.
-
If the file being installed has a version resource, and the file on the target system does not, the file with the version resource will replace the existing file.
-
If neither file has a version resource, the existing file will be overwritten if its Created and Modified times are the same.
-
If the Modified date of an existing file is later than the file's creation date, then the file is not overwritten. This protects user preference files from being wiped out during an upgrade or reinstallation. Very important!
Now, if you are debugging a Basic MSI installation and files are being overwritten that aren't supposed to be, or files are not being overwritten that are supposed to be, then you can use a log file to determine why this is happening.
Finally, if an installation tries to overwrite an executable file that is currently running, a dialog is displayed telling the user to close the application.