且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Wix 安装程序:有条件决定使用哪个 ComponentGroupRef 的一项功能

更新时间:2023-11-10 20:31:28

正如您发现的那样,功能的标题不必是唯一的.您有两个具有相同标题的功能,因此它以这种方式显示.

As you've found the title of a feature does not have to be unique. You have two features with the same title so it shows that way.

尝试使用嵌套特征:

<Feature Id="SQLTools" Title="Tools" Level="1" Description="Installs support UI Tools for SQL Server"> 
  <Feature Id="SQL2008Tools" Title="SQL 2008 Tools" Level="1" Description="Installs all support UI Tools for SQL 2008">
    <Condition Level="1"><![CDATA[SQL2008BINDIR AND NOT SQL2012BINDIR]]></Condition>
    <ComponentGroupRef Id="Tools2008Component"/>
  </Feature>

  <Feature Id="SQL2012Tools" Title="SQL 2012 Tools" Level="1" Description="Installs all support UI Tools for SQL 2012">
    <Condition Level="1"><![CDATA[SQL2012BINDIR]]></Condition>
    <ComponentGroupRef Id="Tools2012Component"/>
  </Feature> 
</Feature>