uninstall custom actions - wix

After which custom action should my C# custom actions execute? And what condition should I use so my custom action could run only on uninstall?

After which custom action should my C#
custom actions execute?
It depends on what they do.
And what condition should I use so my
custom action could run only on
uninstall?
REMOVE = "ALL"

You need to provide the condition in custom action call as to when they should be called.
Example :
<Custom Action="UpdateConfig" After="InstallFinalize">INSTALL_APPLICATION = "1"</Custom>
Here, as you can see the custom action UpdateConfig will be called after everything is installed and if Application was selected as feature while installing.

Related

Wix - schedule custom action between StopServices and StartServices

I would like to add a custom action in my Wix installer that runs between the StopServices and the StartServices. So that the service is down when the custom action is running. If I do the following the action runs before the StartServices, but also before the StopServices.
<Custom Action="IisRewriteRules" After="StopServices" Before="StartServices"> NOT REMOVE~="ALL" </Custom>
It seems that I can't add both a Before and After tag, that gives following error:
Error CNDL0035: The Custom/#After attribute cannot be specified when attribute Before is present. (20)
Is there some way I can achieve this? As a backup I guess I could stop the service in my custom action and restart it again at the end of the custom action, but I would prefer to not have to do that.
Looking online I couldn't really find anything. Is there maybe a way to schedule the ServiceControl?
I found in the Wix Docs that you can add a Sequence tag instead of Before or After. You can pass this an integer value and schedule it between the default actions. Following page shows the default actions and their corresponding Sequence value: Suggested InstallExecuteSequence

WIX: How can I queue custom action between "after InstallFile" and "before "XMLFile" ?

I have a custom action that dynamically generates an XML file based on installed files (can't change this utility). The custom action must execute after "InstallFiles".
I would like to use XMLFile to make other modifications to the XML file based on other features installed.
Any suggestions on how to schedule custom action between "after=InstallFile" and "before "XMLFile" ?
You can do something like
<Custom action="CustomizingXMLData" after="InstallFiles">Condition</Custom>
<Custom action="XMLFile" after="CustomizingXMLData">Condition</Custom>

Is it possible to set property in Deferred custom action in WiX?

is it possible to set a property in Deferred custom action.If so please suggest me the way ?
I had similar dilemma few weeks back. And this is what was told to me by seniors.
Deferred Custom action cannot directly modify installer properties.
But there is an workaround: you can use immediate custom action to set the property.Also you could use CustomActionData to store property value and then use it in C# or VB.net Custom Actions.
I think this Link might help you.

How do you document a custom action using WiX?

The intended behavior of each custom action must be documented for the Windows logo program.
In InstallShield, custom actions are documented using the ISCustomActionReference table.
I am now using WiX to create my installs, how should custom actions be documented using WiX?
There's no reason you can't do the same - you can create a custom table in the MSI file with WiX and add your docs there. The docs typically emphasize custom tables to be used as data for custom actions, so maybe they're harder to find. There's an example here of a custom table WiX element if you scroll down:
How Best to Define a Custom Action

WIX Custom Actions sequence

I have defined a few Custom Actions in my WIX setup, and these actions call third party EXE's that our application depends on. The user decides to install or ignore these 3rd party applications from the feature tree. My CustomAction and binary tags look like this:
<CustomAction Id='NL220_Action' BinaryKey='NL220EXE' Return='asyncWait' />
<Binary Id="NICEXE" SourceFile="..\NL220.exe" />
<CustomAction Id='NIC_Action' BinaryKey='NICEXE' Return='asyncWait' />
<Binary Id="NICEXE" SourceFile="..\NIC.exe" />
Furthermore, my InstallExecuteSequence tag looks like this:
<InstallExecuteSequence>
<Custom Action="NL220_Action" After="InstallFinalize"><![CDATA[(&Optional_NL220=3)]]></Custom>
<Custom Action="NIC_Action" After="NL220_Action"><![CDATA[(&Optional_NIC=3)]]></Custom>
</InstallExecuteSequence>
Everything works fine: the user can select which 3rd party installer packages to run, and these are then run when the installer finishes. The problem is that if the user selects both 3rd party installers, they are run at the same time, thus ignoring the After="NL220_Action" attribute of the second custom action. Any ideas why this is?
Per Custom Action Return Processing Options, the wait of asyncWait occurs at the end of a sequence. Use of this value means that you need the action to succeed, but you don't care exactly when it succeeds. If it waited for the custom action to finish before continuing onward, it would be synchronous. If you need to wait for the first to complete before running the second, then either you need to make the first action synchronous, or possibly combine both actions into a single asynchronous action which itself runs the two sub-actions in ordered sequence.