0

I have a Feature, which references a ComponentGroup. That ComponentGroup is defined in a Fragment in another file and contains number of Components.

This project is shared across multiple versions of the product and I would like to maintain one version of the Product.wxs file (the codebase is common between the product versions).

Can I set a Condition on a ComponentGroup to determine whether or not to include it in the installer?

4

1 回答 1

3

是的你可以。下面的代码片段是完全有效的 WiX 代码:

<Feature Id="MyFeature" Title="Some title" Level="100">
  <ComponentGroupRef Id="ComponentGroup1"/>
  <ComponentGroupRef Id="ComponentGroup2"/>
  <?if $(var.IncludeAnotherGroup) = true ?>
    <ComponentGroupRef Id="AnotherGroup"/>
  <?endif ?>
</Feature>

您可以IncludeAnotherGroup在构建时提供变量的值,例如像这样(NAnt 代码):

<candle ...>
  <defines>
    <define name="IncludeAnotherGroup" value="true" />
  </defines>
  <sources basedir="${paths.wxs}">
    <include name="**.wxs"/>
  </sources>
</candle>
于 2016-08-30T10:46:58.753 回答