I've experimented with deferred custom action type 18. I've read a lot of material on the internet including this similar question How to add a WiX custom action that happens only on uninstall (via MSI)? which gives a big truth table of properties, but nothing seems to match my experiences with my Wix. I've upgraded to the latest Wix 3.11.
File element is within the directory structure...
<File Id='ReplaceRegistryEntriesFile' Source='MikeyRegistryReset.bat'
DiskId='1'
/>
The rest is under Product...
<InstallExecuteSequence>
<Custom Action="RunOnUninstall"
After="InstallInitialize"
>
</Custom>
</InstallExecuteSequence>
<CustomAction Id="RunOnUninstall"
FileKey="ReplaceRegistryEntriesFile"
ExeCommand=" mabwashere"
Impersonate="no" Return="asyncNoWait"
Execute="deferred"
/>
It's actually causing the script to run during the uninstall phase. Why didn't it run during the installation phase? There is no logic (that could possibly have been placed there explained in the link above) currently there to stop it from running anytime it wants to run. I was expecting it to run during both install and uninstall.
It gets more strange. If I change After="InstallInitialize"
to Before="InstallFinalize"
, my batch file then only runs during installation.
Maybe this is unique to deferred custom actions! So is a deferred custom action only ever run once in the Install/Uninstall cycle? I've seen no documentation to tell me this.
WTF is going on?