Lex
Lex

Reputation: 891

WIX - Custom actions on Install but not on Uninstall or Upgrade

I have a wix installer where we have several Custom Actions running, like the registration etc. However we only want these to run on the Install, not on the upgrade or the uninstall.

I've tried setting it to NOT Installed AND REINSTALL but that isn't working either.

Does anyone know what the correct property is when wanting to run certain apps via custom action only on Install and not on Upgrade or uninstall?

 <InstallExecuteSequence>
     <Custom Action="PosConfig.CustomAction" Before="StartServices"><![CDATA[NOT Installed AND NOT UPGRADINGPRODUCTCODE AND UILevel>3]]></Custom>
     <Custom Action="Register.CustomAction" After="PosConfig.CustomAction">NOT Installed AND NOT UPGRADINGPRODUCTCODE </Custom>
     <Custom Action="OPOSSelectorFirst.CustomAction" After="Register.CustomAction"><![CDATA[NOT Installed AND NOT UPGRADINGPRODUCTCODE AND &ProductFeature=3 AND Not OPOSDLLINSTALLED]]></Custom>
     <Custom Action="OPOSSelectorUpdate.CustomAction" After="OPOSSelectorFirst.CustomAction"><![CDATA[NOT Installed AND NOT UPGRADINGPRODUCTCODE AND &ProductFeature=3 AND Not OPOSDLLINSTALLED]]></Custom>
  </InstallExecuteSequence>

EDIT: Added my Custom Action Sequence.

Upvotes: 9

Views: 19613

Answers (2)

Chris
Chris

Reputation: 3121

NOT Installed AND REINSTALL can never be true at the same time. That would mean the application is not installed but is currently being re-installed. How would that work?

Schedule your custom action by using this condition instead:

NOT Installed AND NOT UPGRADINGPRODUCTCODE

This prevents it from being triggered on major upgrades.

Upvotes: 16

Aleksandr
Aleksandr

Reputation: 349

UPGRADINGPRODUCTCODE is set during the RemoveExistingProducts action. Depending on your MajorUpgrade Schedule it may be too late. I've come to solution NOT Installed AND NOT WIX_UPGRADE_DETECTED.

Upvotes: 4

Related Questions