Question

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?

Was it helpful?

Solution

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!" />

OTHER TIPS

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!" />
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top