Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

wix

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.

like image 642
Lex Avatar asked Mar 02 '12 14:03

Lex


People also ask

How does WiX Installer work?

The WiX tools follow the traditional compile and link model used to create executables from source code. At build time, the WiX source files are validated against the core WiX schema, then processed by a preprocessor, compiler, and linker to create the final result.


2 Answers

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.

like image 118
Chris Avatar answered Oct 05 '22 12:10

Chris


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.

like image 34
Aleksandr Avatar answered Oct 05 '22 12:10

Aleksandr