开发者

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 li开发者_开发知识库ke an implementation detail that I should not rely on.

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


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


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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜