WiX .NET Bootstrapper - Feature Selection

折月煮酒 提交于 2019-12-21 12:58:58

问题


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.


回答1:


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


来源:https://stackoverflow.com/questions/29486141/wix-net-bootstrapper-feature-selection

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!