I am trying to run a script with Wix installer and I would like the script to run only in the following scenarios:
- Before removing installation files on upgrade/uninstall
- 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