1
votes

I have a custom action that has to execute only during install but not during minor release upgrade and remove? I tried with different conditions but the CA is executing during minor release.

1) (NOT Installed) OR NOT(REMOVE="ALL" AND UPGRADINGPRODUCTCODE)

2) (NOT Installed)

3) (NOT Installed) OR NOT(Installed AND REMOVE="ALL" AND UPGRADINGPRODUCTCODE)

but nothing works for me. And my CA is executing twice may be because during upgrade the setup is uninstalling and installing. Any suggestions how to execute CA only during install but not during upgrades.

1
Is this an immediate mode custom action?Stein Åsmul

1 Answers

2
votes

Please Test: You could try with (NOT Installed) AND (NOT WIX_UPGRADE_DETECTED) as a first test (see this answer), and then use the debugging approach below to test properly. No guarantees! Conditions are notorious.

  • A commonly used way to test if you are running uninstall as a part of major upgrade is to use the UPGRADINGPRODUCTCODE property.
  • You should be aware of these issies with regards to UPGRADINGPRODUCTCODE - it might not behave as you would expect at face value.
  • I suggest using WIX_UPGRADE_DETECTED instead of UPGRADINGPRODUCTCODE in the above condition to keep it as simple as possible. This is a WiX-specific property (UPGRADINGPRODUCTCODE is a built-in MSI property).

Top Tip: MSI conditions are notoriously fiddly to get right. You can debug MSI conditions pretty efficiently by the approach described here: How to execute conditional custom action on install and modify only? (see bottom section - using VBScript message boxes and then run the setup in different modes).

Minor Upgrades: Please be aware that minor upgrades are very limited - and another answer. Please review the restrictions to make sure you are aware of them and that you can release your software with them in mind. Also make sure to test repair and modify scenarios for the installer.

Advice: Often it is better to use the launch sequence of the application to perform application configuration than relying on custom actions since they have complex sequencing, conditioning and impersonation issues.