Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to execute custom action only in install (not uninstall)

I'm sure this is fairly easy, but I've kind of had a hard time with it. I've got a custom action that executes a different (non-msi) installer on installation. Unfortunately, I've noticed that it also executes the installer on UNinstallation!

I've looked through the options but I cant' seem to find out how to stop this. If anybody could help me I would be incredibly grateful.

Also, how do I set a custom action to go off only during UNinstall? Any help is greatly appreciated guys!

like image 852
Cyprus106 Avatar asked Feb 11 '09 16:02

Cyprus106


4 Answers

Add a condition on the action so it's only triggered during installation, not uninstallation.

Action run only during Install

NOT Installed AND NOT PATCH

Action runs during Install and repair

NOT REMOVE

Run on initial installation only:

NOT Installed

Run on initial install or when repair is selected.

NOT Installed OR MaintenanceMode="Modify"

To only run an action during uninstall use the following condition:

REMOVE~="ALL"

To only run an action during upgrade:

Installed AND NOT REMOVE
like image 157
saschabeaumont Avatar answered Oct 24 '22 10:10

saschabeaumont


An example:

<InstallExecuteSequence>
..
    <Custom Action="QtExecIdOfCA" Before="InstallFinalize">NOT Installed</Custom>
..
</InstallExecuteSequence>

..
..
<CustomAction Id="QtExecIdOfCA" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="deferred" Return="ignore" Impersonate="no"/>

Notice! Condition is added to the <Custom> tag and not the <CustomAction> it confused me, because Custom is followed by Action attribue

like image 42
kristoffer_o Avatar answered Oct 24 '22 10:10

kristoffer_o


A bit of a correction:

Finally, to only run an action during uninstall use the following condition: REMOVE="ALL"

This seems more appropriate as the property REMOVE contains the features being uninstalled.
So if I do a modify to remove one feature, REMOVE is true and the action that was to execute only on uninstall executes on modify.
More details here on MSDN

like image 7
Jean-Francois Fortin Avatar answered Oct 24 '22 10:10

Jean-Francois Fortin


Please be careful with REMOVE=ALL. It is not available before installvalidate sequence.
And check below links for more details:
http://msdn.microsoft.com/en-us/library/aa371194(v=vs.85).aspx
http://msdn.microsoft.com/en-us/library/aa368013(v=vs.85).aspx

like image 5
Andy Avatar answered Oct 24 '22 10:10

Andy