Where to place RemoveExistingProducts in a major MSI upgrade

Posted on

When Windows Installer performs a major upgrade, the position of the RemoveExistingProducts action determines when the uninstall of the old product is performed. Despite efficiency, two factors dominate the decision

  • What should happen if either the install or the uninstall fails?
  • Should the new product ‘see’ registry entries/files/etc from the existing product or should the new product install ‘start from scratch’?

The following table summarizes the four possible approaches.

Position Audit scripted? Which product remains if … Unchanged files are reinstalled? uninstall fails? install fails?

Between InstallValidate and InstallInitializeRemove old, install new No Old Neither Yes
After InstallFinalizeInstall new, remove old No Both Old No
After InstallInitialize, before any script-generating actionsRemove old, install new Yes Old Old Yes
Between InstallExecute (or InstallExecuteAgain) and InstallFinalizeInstall new, remove old Yes Old Old No

« Back to home