We are trying to get a custom .NET Bootstrapper to selectively install features in an MSI package through our WiX installer.
Having registered to the event PlanMsiFeature we thought that we would be able to access the features in our MSI and exclude certain features based upon preset conditions. The event, however, never appears to be invoked. Has anybody managed to use this event successfully?
Many thanks.
We solved this issue. There were a couple of key items missing.
1) In the Bundle that contains our application, the MSI Package was required the following attribute.
EnableFeatureSelection="yes"
2) In the managed bootstrapper application we were setting the install condition (state) to Absent for the feature we don't wish to install. The missing piece here was that all the items we do wish to install need to have Local set for their state as Unknown causes all items to be installed.
void CustomBA_PlanMsiFeature(object sender, PlanMsiFeatureEventArgs e)
{
if (e.FeatureId == "FEATURE_TO_EXCLUDE")
e.State = m_installFeature ? FeatureState.Local : FeatureState.Absent;
else
e.State = FeatureState.Local;
}