My WIX custom action should delete a SQL Job when the product is uninstalled. This works perfectly if the MSI is executed and REMOVE is selected.
However, it never seems to run if the product is removed via Add/Remove programs.
Here is my InstallExecuteSequence section
<Custom Action="CleanupServer_Set" Before="CleanupServer"><![CDATA[NOT UPGRADINGPRODUCTCODE AND (REMOVE="ALL")]]></Custom>
<Custom Action="CleanupServer" Before="RemoveFiles"><![CDATA[NOT UPGRADINGPRODUCTCODE AND (REMOVE="ALL")]]></Custom>
And this is my custom action definition
<CustomAction Id="CleanupServer_Set" Property="CleanupServer" Value="SERVER=[SERVER];DBFILES=[DBFILES]" Execute="immediate"/>
<CustomAction Id="CleanupServer" BinaryKey="CA" DllEntry="CleanupServer" Execute="deferred" Return="ignore" Impersonate="no"/>
Any help would be greatly appreciated. Since I'm running the uninstall via Control Panel, I do not have a debug log file to review to see what is happening.
UPDATE: In
Add / Remove Programs
. Maybe tryModify
instead ofRemove
- if available. This will run the uninstall in GUI mode, instead of in silent mode which is what is used when you selectRemove
.Impersonation: In silent mode the properties you depend on might not be set (if they are set in the GUI normally), or you could fail to connect to the database because
msiexec.exe
(the Windows Installer Engine) runs in system context. I believe one, or both of these issues to be at least part of your problem. Is it a remote database?Maybe first try to set
Impersonate
toyes
, like this (don't run in system context, impersonate launching user):Alternatively maybe try to run it non-deferred (immediate and unelevated), and maybe set it to run only once:
Just suggestions to try, I haven't tested.
Global Logging: First things first, enable global logging on the machine and get yourself a log file that way - please see section: "Globally for all setups on a machine". Essentially just add this section to the registry (but check the link for more details and context):
Suggested Steps:
Debug
andLogging
)%TEMP%
and press EnterThere is also a section on how to interpret log files - in case you want to have a look first yourself. Essentially, search for the custom action names, relevant property values and skim the immediate "surroundings" of the entries you find. Logging is verbose indeed, but helpful.
Persist / Read Back Property Values: Here is an answer showing persisting of properties and how you can read them back with AppSearch. Remember to test such features well in all installation modes (
install
,uninstall
,modify
,remove
,major upgrade
,silent and interactively
- there are usually surprises).