问题描述
我想在多个组件上设置条件,但不希望每个组件一遍又一遍地重复使用该条件,而是在不是启动入口条件的条件下将组件组合在一起片段是。
使用的想法?例如,ComponentGroup 不是 Directory 的有效子项,我真的不知道用什么来将下面的前两个组件与一个条件组合在一起。
附注。 Fragment、DirectoryRef 和 Directory 我不允许更改。
我想要这样的东西:
<Fragment>
<DirectoryRef Id="blbalba">
<Directory Id="bin" Name="bin">
**<Condition>**
<my condition>
<Component Id="id1.dll" Guid="{a guid}">
<File Id="id2.dll" KeyPath="yes" Source="mysource.dll" />
</Component>
<Component Id="id3.dll" Guid="{another guid}">
<File Id="id3.dll" KeyPath="yes" Source="anothermysource.dll" />
</Component>
**</Condition>**
<Component> **bla bla bla no condition here**
</Component>
</Directory>
</DirectoryRef>
</Fragment>
解决方法
您可以将组件分组为一个功能并为此功能定义单个条件。
否则,您必须为每个组件单独定义每个条件。
条件只能在这些元素上设置:Component、Control、Feature、Fragment、PermissionEx、Product
。https://wixtoolset.org/documentation/manual/v3/xsd/wix/condition.html