Why can't I select individual features from my FeatureGroup when I use FeatureGroupRef?

StackOverflow https://stackoverflow.com/questions/21759635

  •  11-10-2022
  •  | 
  •  

Question

I have a FeatureGroup in a Fragment that looks something like this:

<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>

And I reference this FeatureGroup from my main feature like this:

<Feature Id="MainFeature" Title="Super Awesome Program"  Level="1" AllowAdvertise="no" InstallDefault="local" Display="expand">
  <FeatureRef Id="SomeOtherFeature"/>      
  <FeatureGroupRef Id="ConsolidatedFeatureCollection"/>
</Feature>

The FeatureGroup documentation says that it "groups together multiple components, features, and merges to be used in other locations." And the FeatureGroupRef documentation says that it is used to "create a reference to a FeatureGroup in another Fragment." It seems pretty straight forward, so I would expect that using this FeatureGroupRef as I have above would produce exactly the same result as using a FeatureRef for each individual Feature:

<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>

In fact, this seems to be exactly the purpose of the FeatureGroup element. Not so, when I use <UIRef Id="WixUI_FeatureTree"/> or any reference to the FeaturesDlg. Using the FeatureGroupRef, I cannot install individual Features. If any one of the Features in the group is selected, ALL are installed. You never see any indication of this in the UI, but they are installed.

I'm using the stable release of WIX toolset 3.8 (v3.8.1128.0), and I'm rather new to WIX, so I'm hesitant to assume that such a large bug has escaped the community for several months. Am I missing something about the way FeatureGroups work? And is there a work-around to allow selection of individual Features, other than a FeatureRef for every single Feature? (in real life, there are a lot more than four, and several projects which will use them)

Was it helpful?

Solution

I figured out what's wrong. It's a little embarrassing. ComponentCollection is the ComponentGroup that contains Component1, Component2, Component3, and Component4. I added that to the FeatureGroup because I thought that I needed to reference where these components are coming from. What I was actually doing was including all of the Components in the FeatureGroup. I was under the impression that a FeatureGroup simply contained Features, but apparently, it can install content of its own independent of its Features.

Once I removed <ComponentGroupRef Id="ComponentCollection" /> from the FeatureGroup, I started getting the behavior that I expected.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top