Detecting MajorUpgrade in Wix 3.8

2019-07-06 05:36发布

问题:

I am installing all new versions of my software as major upgrades, as the installations are very small and most of the time, all files change anyway.

I would like to skip one dialog in the installer, if an upgrade as compared to a fresh installation is done, but so far I have failed to figure out what conditional (like "Installed AND PATCH") in the following example to use.

     <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" 
              Value="WelcomeDlg" Order="2">Installed AND PATCH</Publish>

回答1:

You need to show us your major upgrade element or your upgrade elements in the WiX for details, but the way you detect that you're doing an upgrade is to use the upgrade property name. Sometimes the name is PREVIOUSVERSIONSINSTALLED, but if you used the MajorUpgrade elements it sets a property called WIX_UPGRADE_DETECTED.

http://wixtoolset.org/documentation/manual/v3/xsd/wix/majorupgrade.html

That means the condition in your dialog will be:

Not WIX_UPGRADE_DETECTED

if you want to suppress the dialog. You don't want PATCH because you are not doing anything at all related to patches.



回答2:

You can identify a major upgrade by the special property UPGRADINGPRODUCTCODE.

The condition listed: (Installed AND PATCH) should make the dialog show only during patch installs though?

Check this cheat sheet of MSI conditons from Installshield. It is not complete, but better than nothing.