How to perform a user action in WiX only if the installed function is deleted?

I have a WiX installer that has custom actions for each function that need to be performed when uninstalling. Right now I am having a problem when actions are performed regardless of whether this function was actually installed by the user. Custom actions fail because they expect certain resources to exist, and then the whole installation gets stuck in a broken state.

What is the correct way to trigger a custom action if and only if its associated function is removed? I have included the snippet that I use below if this helps.

<Custom Action="LaunchUninstallCustomAction" Before="RemoveFiles"><![CDATA[(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL") AND (&FeatureName<=2)]]></Custom> 
+6
windows-installer wix custom-action
source share
2 answers

Try

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

See MSDN for condition syntax details and examples.

+16
source share

It seems that user actions are broken and do not properly handle the missing resources.

How would a CA handle it if a user manually deletes files? What happens if a user deletes an application folder and then tries to delete it through ARP?

What happens if the user simply removes the function without deleting the entire application? You will be better off fixing CA for the long term.

-3
source share

All Articles