Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you execute a custom action in WiX only if an installed feature is being uninstalled?

I have a WiX installer that has per-feature custom actions that need to be executed on uninstall. Right now I'm running into a problem where the actions execute whether or not the feature was actually installed by the user. The custom actions fail because they expect certain resources to exist and then the entire install is stuck in a broken state.

What is the correct way to run a custom action if and only if its related feature is being uninstalled? I have included the snippet that I'm currently using below, if it helps.

<Custom Action="LaunchUninstallCustomAction" Before="RemoveFiles"><![CDATA[(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL") AND (&FeatureName<=2)]]></Custom>
like image 876
dskiles Avatar asked Feb 02 '10 18:02

dskiles


1 Answers

Try

<Custom Action="LaunchUninstallCustomAction" Before="RemoveFiles">
   <![CDATA[(NOT UPGRADINGPRODUCTCODE) 
             AND (&FeatureName=2) AND (!FeatureName=3)]]>
</Custom>

See MSDN for details of condition syntax and examples

like image 177
Samuel Jack Avatar answered Nov 13 '22 23:11

Samuel Jack