Wix 安装程序:有条件决定使用哪个 ComponentGroupRef 的一项功能 [英] Wix Installer: One feature with condition to decide which ComponentGroupRef to use

查看:18
本文介绍了Wix 安装程序:有条件决定使用哪个 ComponentGroupRef 的一项功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的安装程序有一个名为工具"的功能

My installer has a Feature called "Tools"

此功能安装的内容取决于客户端运行的 SQL Server 版本.

What is installed by this feature is dependent on which version of SQL Server the client is running.

我怎样才能让一个功能的条件显示为如果 SQL 2008 执行 ComponentGroupRef ID=SQL2008 否则为 ComponentGroupRef ID=SQL2012"

How can I have one feature with a condition that says "If SQL 2008 do ComponentGroupRef ID=SQL2008 otherwise ComponentGroupRef ID=SQL2012"

我正在创建 2 个属性来保存 SQL2008 和 SQL2012 的目录,所以这些是我用来做出决定的属性.

I'm creating 2 properties to hold the directory for SQL2008 and SQL2012, so those are the properties I'm using to make my determination.

这很接近,但两次显示工具"功能.

This is close, but shows "Tools" feature twice.

<Feature Id="SQL2008Tools" Title="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="Tools" Level="1" Description="Installs all support UI Tools for SQL 2012">
      <Condition Level="1"><![CDATA[SQL2012BINDIR]]></Condition>
      <ComponentGroupRef Id="Tools2012Component"/>
    </Feature>   

一如既往 - 感谢您的帮助!

As always - thanks for any help!

推荐答案

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

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> 

这篇关于Wix 安装程序:有条件决定使用哪个 ComponentGroupRef 的一项功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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