UPGRADINGPRODUCTCODE and Major Upgrade vs. Uninstall

Many people working with MSI aren’t aware of the UPGRADINGPRODUCTCODE (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/upgradingproductcode.asp) property, which Windows Installer sets when uninstalling the product being upgraded. This property should be used to condition custom actions that need to be run only when “really” uninstalling vs. uninstalling as part of an upgrade.

So…

  • if you want a custom action to be executed only when uninstalling, add “AND NOT UPGRADINGPRODUCTCODE” to your condition
  • if you want a custom action to be executed only when upgrading, add “AND UPGRADINGPRODUCTCODE” to your condition
  • if you want a custom action to be executed only when being upgraded by a specific product (generally relevant only when multiple “editions” of a product exist), refer to the specific product code, e.g. AND UPGRADINGPRODUCTCODE=”{ABC-123}”

Leave a Reply