Major Upgrade: If your MSI is performing a major upgrade, then the product code of the previous version will be added to the property specified as the ActionProperty in the Upgrade table of the newest package. In WiX this property is generally called WIX_UPGRADE_DETECTED
by convention, but it can be called anything.
In other words, checking whether WIX_UPGRADE_DETECTED
or an equivalent property has any value at all can be used to detect that an upgrade is taking place.
UPGRADINGPRODUCTCODE: In the older setup - the one that is being uninstalled during the major upgrade - the built-in MSI property (as opposed to one you declare) UPGRADINGPRODUCTCODE
will be set to the product code of the newer setup. In other words you can use this property (UPGRADINGPRODUCTCODE
) in conditions in the old package, but it will not be set in the newer setup. This is a very common confusion. Please see this answer for a better description of this confusion: Run Wix Custom action only during uninstall and not during Major upgrade
Finding Installed Product: You can get the product code for an installed product easily: How can I find the product GUID of an installed MSI setup? The MSI API features a lot of methods and properties that can be used to determine pretty much whatever you want about an installed MSI. It can be accessed via COM, Win32, Managed code.
UPDATE: the script here shows how to identify related products by means of the MSI API RelatedProducts call. Towards bottom.
Some Links: