1

I have two custom actions (immediate and deferrend). I would like to skipping actions during upgrade.

I tried:

 <Product Id="*" Name="$(var.ProductName)" Language="1033" Version="$(var.Version)" 
          Manufacturer="$(var.Manufacturer)" UpgradeCode="{GUID}">

    <MajorUpgrade DowngradeErrorMessage="Newer version is already installed." />

<Custom Action='CAa' After='InstallInitialize'>NOT Installed AND NOT PATCH</Custom>

and:

<Custom Action='CAa' After='InstallInitialize'>NOT Installed AND NOT UPGRADINGPRODUCTCODE</Custom>

Currently, actions starts during the update.

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
WymyslonyNick
  • 117
  • 3
  • 19
  • 1
    Perhaps you can try the PDF sheet with conditions in [**this answer**](http://stackoverflow.com/a/25254754/129130). – Stein Åsmul May 25 '15 at 18:01
  • Please check [**this post**](http://stackoverflow.com/questions/320921/how-to-add-a-wix-custom-action-that-happens-only-on-uninstall-via-msi/17608049) too. Check the table and discussion towards the bottom. These conditions are fiddly to get right. – Stein Åsmul May 25 '15 at 18:33

2 Answers2

2

These conditions are fiddly to get right - there are many options and modes for the InstallExecuteSequence (first time install, major upgrade install, minor upgrade install, maintenance install, uninstall, major upgrade uninstall sequence, patching, auto repair etc...). As I wrote in the comment above, you can try this PDF from Flexera.

No guarantees, but here is a proposal. You can try if this is what you want by showing message boxes from your CA (I can't test this using this lousy thin client, so it is a bit risky to try to answer without having done my own testing - please check carefully yourself):

Not Installed AND NOT PATCH AND NOT UPGRADINGPRODUCTCODE AND NOT REMOVE=~"ALL").

  • (NOT Installed) = run during first time installation
  • (NOT PATCH) = don't run during patching
  • (NOT UPGRADINGPRODUCTCODE) = don't run during a major upgrade uninstall
  • (NOT REMOVE=~"ALL") = don't run on uninstall

"Reference style table":

Community
  • 1
  • 1
Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
  • 1
    Just for the records, the tilde ~ goes before = So, it should be (NOT REMOVE~="ALL") https://msdn.microsoft.com/en-us/library/aa368012(v=vs.85).aspx – Oscar Jun 29 '17 at 07:52
2

When you're doing a major upgrade with WiX MajorUpgrade the WIX_UPGRADE_DETECTED is set - see:

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

so that is what you use in the upgrade install to detect that there is an older product installed. In other words it means that the new incoming install has detected an older version that is being upgraded.

UPGRADINGPRODUCTCODE is not the one to use. This property is set in the old product being upgraded and uninstalled so it knows the difference between being uninstalled and being upgraded, as the docs here say:

https://msdn.microsoft.com/en-us/library/aa372380(v=vs.85).aspx

"An application determines whether it is being removed by an upgrade or the Add or Remove Programs by checking UPGRADINGPRODUCTCODE."

Its value is the ProductCode of the incoming upgrade that is causing it to be removed.

PhilDW
  • 20,260
  • 1
  • 18
  • 28