Aaron Harrington
Aaron Harrington

Reputation: 532

Wix - Run Custom Action only On Upgrade and Patch Not on Repair/Reinstall

I want to run a Wix custom action only on upgrade and patches and NOT install/reinstall or repair. So basically only if the version number of the application is increasing should this custom action run. I tried the following rule and it disabled the custom action completely on patching:

<Custom Action="upgrade_action"
        Before="InstallFinalize">Installed AND NOT REMOVE AND UPGRADINGPRODUCTCODE</Custom>

What can I do to achieve this?

Upvotes: 3

Views: 3109

Answers (1)

PhilDW
PhilDW

Reputation: 20790

If this is the new major upgrade product and you are using the WiX MajorUpgrade element then the WIX_UPGRADE_DETECTED property is set if it's doing an upgrade and detecting an older version. UPGRADINGPRODUCTCODE is set in the old product being upgraded, the one that's already installed.

It looks like all you need is WIX_UPGRADE_DETECTED Or PATCH if you want the CA to run on either of those conditions only.

Upvotes: 6

Related Questions