2

当 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>

这可能吗?

4

1 回答 1

4

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

于 2012-08-15T02:46:07.123 回答