I am using WIX for creating the installer of my application. During uninstalling the application, I want to call a function in a DLL file before the uninstaller deletes the files which the DLL file is part of them. I checked other related post like this post to proceed.
I created a CustomAction
as follows:
<CustomAction Id="UnRegister"
FileKey="mydll.dll"
DllEntry="cleanup"
Execute="immediate"
Return="ignore"/>
and then the InstallExecuteSequence
tag:
<InstallExecuteSequence>
<Custom Action="UnRegister" After="InstallInitialize">Installed AND NOT UPGRADINGPRODUCTCODE</Custom>
</InstallExecuteSequence>
The problem is when I try to uninstall the application, the files are removed first and then the installer calls the cleanup() function in DLL. After the error the uninstall rolls back and fails.
How can I configure the WIX installer so that it calls the function first and then delete the files during uninstall?
Thanks