我在片段中有一个 FeatureGroup,看起来像这样:
<Fragment>
<FeatureGroup Id="ConsolidatedFeatureCollection">
<ComponentGroupRef Id="ComponentCollection" />
<Feature Id="Feature1" Title="Feature1" Level="1" AllowAdvertise="no" >
<ComponentRef Id="Component1" />
</Feature>
<Feature Id="Feature2" Title="Feature2" Level="1" AllowAdvertise="no" >
<ComponentRef Id="Component2" />
</Feature>
<Feature Id="Feature3" Title="Feature3" Level="1" AllowAdvertise="no" >
<ComponentRef Id="Component3" />
</Feature>
<Feature Id="Feature4" Title="Feature4" Level="1" AllowAdvertise="no" >
<ComponentRef Id="Component4" />
</Feature>
</FeatureGroup>
我从我的主要功能中引用了这个 FeatureGroup,如下所示:
<Feature Id="MainFeature" Title="Super Awesome Program" Level="1" AllowAdvertise="no" InstallDefault="local" Display="expand">
<FeatureRef Id="SomeOtherFeature"/>
<FeatureGroupRef Id="ConsolidatedFeatureCollection"/>
</Feature>
FeatureGroup文档说它“将多个组件、功能和合并组合在一起,以便在其他位置使用。” FeatureGroupRef文档说它用于“在另一个 Fragment 中创建对 FeatureGroup 的引用”。看起来很简单,所以我希望像上面那样使用这个 FeatureGroupRef 会产生与为每个单独的特性使用 FeatureRef 完全相同的结果:
<Feature Id="MainFeature" Title="Super Awesome Program" Level="1" AllowAdvertise="no" InstallDefault="local" Display="expand">
<FeatureRef Id="SomeOtherFeature"/>
<FeatureRef Id="Feature1"/>
<FeatureRef Id="Feature2"/>
<FeatureRef Id="Feature3"/>
<FeatureRef Id="Feature4"/>
</Feature>
事实上,这似乎正是 FeatureGroup 元素的用途。不是这样,当我使用<UIRef Id="WixUI_FeatureTree"/>
或引用 FeaturesDlg 时。使用 FeatureGroupRef,我无法安装单个功能。如果选择了组中的任何一项功能,则会安装所有功能。您永远不会在 UI 中看到任何指示,但它们已安装。
我正在使用 WIX 工具集 3.8 (v3.8.1128.0) 的稳定版本,而且我对 WIX 还很陌生,所以我不敢假设这么大的 bug 已经逃离社区几个月了。我是否遗漏了有关 FeatureGroups 工作方式的一些信息?除了每个功能的 FeatureRef 之外,是否有一种解决方法允许选择单个功能?(在现实生活中,不止四个,还有几个项目会用到它们)