Helix 88
Helix 88

Reputation: 701

Wix Burn EnableFeatureSelection

I have a Wix installer that installs 2 MSIs with a custom UI.

I have 3 Features across 2 MSIs.

MSI 1

  1. Feature A
  2. Feature B

MSI 2

  1. Feature C

Users have the option to install A,B,AB,ABC or C.

To set the features as optional I have set the EnableFeatureSelection="yes" and set the PlanMsiFeature to Local/Absent depending on if the user wants to include them.

This is working for the 2 features in MSI 1, but not MSI 2. What am I missing?

Thanks

Bundle Code

    <Chain>
      <MsiPackage Id="1" Name="1.msi" SourceFile="1.msi" Vital="yes" Compressed="no" EnableFeatureSelection="yes"
                  DisplayName="1">
      </MsiPackage>
      
      <MsiPackage Id="2" Name="2.msi" SourceFile="2.msi" Vital="yes" Compressed="no"  EnableFeatureSelection="yes"
        DisplayName="2">
      </MsiPackage>
    </Chain>

BootstrapperApplication

PlanMsiFeature += SetupModel_PlanMsiFeature;

void SetupModel_PlanMsiFeature(object sender, PlanMsiFeatureEventArgs e)
{
    switch (e.FeatureId)
    {
        case "FeatureA":
            {
                e.State = IncludeA ? FeatureState.Local : FeatureState.Absent;
                return;
            }
        case "FeatureB":
            {
                e.State = IncludeB ? FeatureState.Local : FeatureState.Absent;
                return;
            }
        case "FeatureC":
            {
                e.State = IncludeC ? FeatureState.Local : FeatureState.Absent;
                return;
            }
    }

    e.State = FeatureState.Local;
}

Upvotes: 0

Views: 444

Answers (1)

Helix 88
Helix 88

Reputation: 701

This took some trial and error. Mostly error.

Wix appears to require at least 1 feature in an MSI so I add an empty feature to both MSIs.

<Feature Id="blankFeature">
<Feature>

Upvotes: 0

Related Questions