WiX - 在自定义操作中设置多个属性

时间:2012-08-15 02:32:42

标签: wix custom-action

当ALLUSERS为1时,我有几个要设置的属性:

<CustomAction Id="CA1" Property="InstallDir" Value="[MYINSTALLDIR]" Execute="immediate" />
<CustomAction Id="CA2" Property="Version" Value="2.0" Execute="immediate" />
<CustomAction Id="CA3" Property="x" Value="x" Execute="immediate" />
<CustomAction Id="CA4" ... />
<CustomAction Id="CA5" ... />

<InstallExecuteSequence>
    <Custom Action="CA1" After="AppSearch">ALLUSERS=1</Custom>      
    <Custom Action="CA2" After="AppSearch">ALLUSERS=1</Custom>      
    <Custom Action="CA3" After="AppSearch">ALLUSERS=1</Custom>      
    <Custom Action="CA4" After="AppSearch">ALLUSERS=1</Custom>      
    <Custom Action="CA5" After="AppSearch">ALLUSERS=1</Custom>      
</InstallExecuteSequence>

这是有效的,但我想知道是否有更简洁的方式而不是大量的CA和愚蠢的ID,如:

<CustomAction Id="CA" Property="InstallDir=[MYINSTALLDIR]; Version=2.0; x=x; y=y; z=z ..." Execute="immediate" />

<InstallExecuteSequence>
    <Custom Action="CA" After="AppSearch">ALLUSERS=1</Custom>      
</InstallExecuteSequence>

这可能吗?

1 个答案:

答案 0 :(得分:4)

您可以编写多次调用MsiSetProperty()的C ++自定义操作。但技术上会有更多的失败风险。一旦设置,一堆设置属性CA通常不那么可怕。