WiX .NET Bootstrapper - 功能选择 [英] WiX .NET Bootstrapper - Feature Selection

查看:23
本文介绍了WiX .NET Bootstrapper - 功能选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在尝试使用自定义 .NET Bootstrapper 来通过我们的 WiX 安装程序有选择地安装 MSI 包中的功能.

We are trying to get a custom .NET Bootstrapper to selectively install features in an MSI package through our WiX installer.

注册到活动 PlanMsiFeature 后,我们认为我们将能够访问 MSI 中的功能并根据预设条件排除某些功能.然而,该事件似乎从未被调用过.有没有人成功使用过这个活动?

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?

非常感谢.

推荐答案

我们解决了这个问题.缺少几个关键项目.

We solved this issue. There were a couple of key items missing.

1) 在包含我们应用程序的 Bundle 中,MSI Package 需要以下属性.

1) In the Bundle that contains our application, the MSI Package was required the following attribute.

EnableFeatureSelection="yes"

2) 在托管引导程序应用程序中,我们将不希望安装的功能的安装条件(状态)设置为不存在.这里缺少的部分是我们希望安装的所有项目都需要将它们的状态设置为 Local 作为 Unknown 导致安装所有项目.

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

这篇关于WiX .NET Bootstrapper - 功能选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆