1

我在片段中有一个 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 之外,是否有一种解决方法允许选择单个功能?(在现实生活中,不止四个,还有几个项目会用到它们)

4

1 回答 1

2

我知道出了什么问题。这有点尴尬。ComponentCollection 是包含 Component1、Component2、Component3 和 Component4 的 ComponentGroup。我将它添加到 FeatureGroup 是因为我认为我需要参考这些组件的来源。我实际上在做的是在 FeatureGroup 中包含所有组件。我的印象是 FeatureGroup 只包含 Features,但显然,它可以独立于其 Features 安装自己的内容。

从 FeatureGroup 中删除<ComponentGroupRef Id="ComponentCollection" />后,我开始获得预期的行为。

于 2014-02-13T17:04:48.710 回答