0

I am trying to run a script with Wix installer and I would like the script to run only in the following scenarios:

  1. Before removing installation files on upgrade/uninstall
  2. When installing the product for the first time

I have tried endless combinations of Wix and custom ones but none worked. My latest try is:

 <InstallExecuteSequence>
      <!-- This script will run only when removing the installation files -->
      <Custom Action='BackupPreviousVersionAction' After="InstallInitialize">
        (Not Installed AND NOT UPGRADINGPRODUCTCODE) OR (Installed AND REMOVE~="ALL" AND UPGRADINGPRODUCTCODE)
      </Custom>
    </InstallExecuteSequence>

It runs well on all scenarios except for upgrade. When I do upgrade, when the product is being removed the script is called, but the issue is that when Wix is installing the new version the script executes one more time.

I want to be able to execute ONCE on upgrade or uninstall or fresh-install

I tried also working with what is suggested here https://stackoverflow.com/a/18531890/14438633

Gilad Dahan
  • 508
  • 5
  • 19

1 Answers1

0

It seems like this condition did the trick:

(Not Installed AND NOT WIX_UPGRADE_DETECTED) OR REMOVE~="ALL"
Gilad Dahan
  • 508
  • 5
  • 19