Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ordering the execution of WiX SetProperty actions

I have a sequence of SetProperty actions which rely on each other. Here is a simplified example:

<SetProperty Id="A" Before="AppSearch" Value="Hello" />
<SetProperty Id="B" Before="AppSearch" Value="[A] world!" />

Property A needs to be set before property B in this case, so that the value of B becomes "Hello world!".

Since WiX doesn't define an attribute to set the custom action name in this case, I don't have a name to use in the Before or After attributes.

I did notice that the execution order of these actions matches the alphabetical order of the property names, but that feels like an implementation detail that I should not rely on.

How do I cleanly enforce the order of SetProperty custom actions?

like image 917
Wim Coenen Avatar asked Nov 28 '09 00:11

Wim Coenen


2 Answers

You can also use the “Action” attribute of the SetProperty element to nail down the name of the custom action. This becomes essential if you wish to set the same property in two distinct SetProperty actions as it removes ambiguous “SetXXX” action names.

For example:

<SetProperty Id="A" Action="MyFirstAction" Before="AppSearch" Value="Hello" />
<SetProperty Id="B" Action="MySecondAction" After="MyFirstAction" Value="[A] world!" />
<SetProperty Id="A" Action="MyThirdAction" After ="MySecondAction" Value="Goodbye cruel world!" />
like image 57
RichWildUK Avatar answered Nov 16 '22 04:11

RichWildUK


I used orca to discover the names generated for the custom actions. They turn out to be SetA and SetB. The following does what I want:

 <SetProperty Id="A" Before="AppSearch" Value="Hello" />
 <SetProperty Id="B" After="SetA" Value="[A] world!" />
like image 24
Wim Coenen Avatar answered Nov 16 '22 02:11

Wim Coenen