当我使用FeatureGroupRef时,为什么我无法从FeatureGroup中选择单个功能?

时间:2014-02-13 16:17:20

标签: wix wix3.8

我在Fragment中有一个看起来像这样的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 documentation表示它“将多个组件,功能和合并组合在一起,以便在其他位置使用。”并且FeatureGroupRef documentation表示它用于“在另一个片段中创建对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,我无法安装单个功能。如果选择了组中的任何一个功能,则安装ALL。您永远不会在UI中看到任何此类迹象,但它们已安装。

我正在使用WIX工具集3.8(v3.8.1128.0)的稳定版本,而且我对WIX很新,所以我犹豫是否认为这么大的bug已经逃过社区几个月了。我错过了一些关于FeatureGroups工作方式的内容吗?除了针对每个功能的FeatureRef之外,还有其他方法可以选择各个功能吗? (在现实生活中,有超过四个,以及几个将使用它们的项目)

1 个答案:

答案 0 :(得分:2)

我发现了什么是错的。这有点令人尴尬。 ComponentCollection是包含Component1,Component2,Component3和Component4的ComponentGroup。我将它添加到FeatureGroup,因为我认为我需要引用这些组件的来源。我实际上在做的是包括FeatureGroup中的所有组件。我的印象是,FeatureGroup只包含Features,但显然,它可以独立于其功能安装自己的内容。

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