使用单个msi安装多个组件

时间:2012-12-20 08:22:49

标签: wix wix3.5

我有一个组装了大约19种不同组件的软件。现在我使用19个安装项目和1个Winforms项目作为主要安装程序。我想转移到WiX,因为我想升级到visual studio 2012.我的问题是:是否有可能在WiX中做到这一点?在我目前的设置中,用户可以通过检查来确定要安装的组件。是否有可能通过WiX创造这样的体验?还有可能在将来只升级其中一个组件吗?

1 个答案:

答案 0 :(得分:2)

是的,对于这种事情它是非常棒的,它称之为Features,你可以简单地设置一组功能(你可以设置 Level 以便你想要安装的东西默认情况下(如果你这样做)被选中,并且未选中任何可选项(如果你愿意)。你也可以在一个功能下有一个功能,对于这样的孩子:

Product  
-Feature 1  
-Feature 2  
--Feature 2 Documentation  
--Feature 2 Admin Tools  
-Feature 3 
(etc)

这些支持标题/描述等使其更好用户友好。

要设置更多进展UI功能,您需要将WixUIExtension.dll的引用添加到安装程序项目,并将UIRef元素添加到产品中(请参阅this article),如:

<UIRef Id="WixUI_FeatureTree" />

您可能希望为要安装的每个“事物”设置一个功能,然后为每个设置一个ComponentGroup,因为您可以定义要安装的任意数量的子组件。

这是一个应该执行上述操作的片段(注意它没有完全充实,只是一个例子):

<UIRef Id="WixUI_FeatureTree" />

<ComponentGroup Id="Component1">
  <ComponentRef Id="Component1"/>
</ComponentGroup>

<Component Id="Component1" Directory="directorytobeinstalledto">
  <File Id="File1" Source="fileweareinstalling"/>
</Component>

<Feature Id="Feature1" Title="Feature 1" Description="My Feature 1" Level="1">
  <ComponentGroupRef Id="Component1"/>
</Feature>
<Feature Id="Feature2" Title="Feature 2" Description="My Feature 2" Level="1">
  <Feature Id="Feature2.Docs" Title="Feature 2 Documentation" Description="My Feature 2 Documentation" Level="1000"/>
  <Feature Id="Feature2.Admin" Title="Feature 2 Admin Tools" Description="My Feature 2 Administration Tools" Level="1000"/>
</Feature>
<Feature Id="Feature3" Title="Feature 3" Description="My Feature 3" Level="0"/> <!-- disabled! -->