In my company we have a software that gets installed via msi built with WiX. It has an executable shipped with it which upgrades old config files.
In the wsx file we have:
<SetProperty Id="PostInstallUpgrade"
Before="PostInstallUpgrade"
Sequence="execute"
Value =""[RMS_SERVICE]upgrade-conf.exe"" />
<CustomAction Id="PostInstallUpgrade"
BinaryKey="WixCA"
DllEntry="WixQuietExec64"
Execute="deferred"
Return="check"
Impersonate="no" />
<InstallExecuteSequence>
<Custom Action="PostInstallUpgrade" After="InstallFiles" />
</InstallExecuteSequence>
The installation works, upgrade-conf.exe does not output any errors as far as I can tell. But when running the uninstaller it seems to get invoked, but fails causing the 1603 error:
MSI (s) (B8:3C) [16:20:04:755]: Executing op: FileRemove(,FileName=upgrade-conf.exe,,ComponentId={2B301043-CCF2-4754-AACC-C797F37C075C})
MSI (s) (B8:3C) [16:20:04:755]: Verifying accessibility of file: upgrade-conf.exe
MSI (s) (B8:3C) [16:20:04:755]: Note: 1: 2318 2:
MSI (s) (B8:3C) [16:20:04:755]: Note: 1: 2318 2:
MSI (s) (B8:3C) [16:20:04:755]: Executing op: SetTargetFolder(Folder=C:\Program Files (x86)\Common Files\<company>\<product>\Data)
MSI (s) (B8:3C) [16:20:04:755]: Executing op: FileRemove(,FileName=data.txt,,ComponentId={16356C87-1AB3-43CF-BF31-ED1EEABC7698})
MSI (s) (B8:3C) [16:20:04:755]: Verifying accessibility of file: data.txt
MSI (s) (B8:3C) [16:20:04:755]: Note: 1: 2318 2:
MSI (s) (B8:3C) [16:20:04:755]: Note: 1: 2318 2:
MSI (s) (B8:3C) [16:20:04:771]: Executing op: ActionStart(Name=PostInstallUpgrade.53B34128_5DC9_4810_8CC8_DA7B0451AC3B,,)
MSI (s) (B8:3C) [16:20:04:771]: Executing op: CustomActionSchedule(Action=PostInstallUpgrade.53B34128_5DC9_4810_8CC8_DA7B0451AC3B,ActionType=3073,Source=BinaryData,Target=WixQuietExec64,CustomActionData="C:\Program Files (x86)\Common Files\<company>\<product>\bin\upgrade-conf.exe")
MSI (s) (B8:7C) [16:20:04:771]: Invoking remote custom action. DLL: C:\Windows\Installer\MSI9C6D.tmp, Entrypoint: WixQuietExec64
WixQuietExec64: Error 0x80070002: Command failed to execute.
WixQuietExec64: Error 0x80070002: QuietExec64 Failed
WixQuietExec64: Error 0x80070002: Failed in ExecCommon method
CustomAction PostInstallUpgrade.53B34128_5DC9_4810_8CC8_DA7B0451AC3B returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
It works when I set Return="ignore"
. But I'd rather disable the execution of the upgrade.exe on uninstallation.
I am not sure why this happens. When I remove the upgrade-conf.exe from the installer everything works fine.
How to I fix this?
As I was studying the logs I saw that the upgrade.exe was deleted before invoking it. I was irritated that it was invoked altough it should run only on installation.
I did some googling and found this: How can I perform a custom action in WiX that only executes on install or uninstall? This seems to work.