‘Always Overwrite’ a file irrespective of MSI versioning rules

I was in search of a method to effective overwrite an existing file though my MSI. It seems windows installer is missing such a functionality as the file versioning rules don’t have a word about it. According to MSDN the file replacing is done considering properties like version, date and language.

The installer only uses these rules when trying to install a file to a location that already contains a file with the same name. In this case, the Windows Installer uses the following rules, all other things being equal, to determine whether to install.

Highest Version Wins—All other things being equal, the file with the highest version wins, even if the file on the computer has the highest version.

Versioned Files Win—A versioned file gets installed over a nonversioned file.

Favor Product Language—If the file being installed has a different language than the file on the computer, favor the file with the language that matches the product being installed. Language-neutral files are treated as just another language so the product being installed is favored again.

Mismatched Multiple Languages—After factoring out any common languages between the file being installed and the file on the computer, any remaining languages are favored according to what is needed by the product being installed.

Preserve Superset Languages—Preserve the file that supports multiple languages regardless of whether it is already on the computer or is being installed.

Nonversioned Files are User Data—If the Modified date is later than the Create date for the file on the computer, do not install the file because user customizations would be deleted. If the Modified and Create dates are the same, install the file. If the Create date is later than the Modified date, the file is considered unmodified, install the file.

Replacing all the existing files

For making an msi package to overwrite all the existing files we can use a property REINSTALLMODE

Pass the following to your msiexec command like to get it done.

eg: msiexec.exe /i yourmsi.msi REINSTALLMODE=omus

‘Always Overwrite’ in Installshield

It seems the Install Shield provides this funtionality. Double click on any file to open the Properties dialog box and check the ‘Always Overwrite’ check box.

My solution – Overwriting Existing Files

The safe solution in my opinion is create a RemoveFile entry for the file to be overwritten and set it to execute in both install and uninstall. ie. set the InstallMode value to 2 / in msidbRemoveFileInstallModeOnBoth mode.

  • Windows Installer Training
  • Adobe CS4 Deployment (Adobe Creative Suite 4 Design Standard)
  • Leave a comment

    Name: (Required)

    eMail: (Required)

    Website:

    Comment: