如何根据wix中的条件设置特征级别? [英] How to set the level of feature based on condition in wix?

查看:33
本文介绍了如何根据wix中的条件设置特征级别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试根据条件安装功能.最初,我将功能级别设置为 1,并在功能内放置一个条件来修改功能级别.

I am trying to install the features based on the condition. Initially i set the feature level to 1 and place a condition inside the feature to modify the feature level.

我无法修改功能级别,并且无论条件如何,它始终设置为 1.

I am unable to modify the feature level and it is always set to 1 only irrespective of condition.

<Feature
        Id = "AddinsFeature"
        Title  = "InstallAddin"
        Level  = "1"
        Absent="allow">
      <ComponentRef Id = "AddInComp"/>
        <Condition Level="0">
          <![CDATA[FALSE]]>
        </Condition>
</Feature>

推荐答案

WiX 特征条件的使用方法主要解释如下:https://www.firegiant.com/wix/tutorial/getting-开始/有条件安装/

How to use WiX feature conditions is essentially explained here: https://www.firegiant.com/wix/tutorial/getting-started/conditional-installation/

要将功能设置为您的条件指定的级别,条件必须评估为真.您可以通过将其设置为 1 来强制它为真:

For a feature to be set to the level specified by your condition, the condition has to evaluate to true. You can force it to be true by setting it to 1:

<Feature Id="AddinsFeature" Title="InstallAddin" Level="1" Absent="allow">

  <!-- Force condition to be true, which sets the feature to the Level attribute value -->
  <Condition Level="0">1</Condition>

  <ComponentRef Id = "AddInComp"/>
</Feature>

在上面,我们将功能的安装级别强制为 0,因为它的条件 1 为真(数字 1 在 MSI 逻辑中为真 - 根据定义 - 如布尔值).在现实世界中,情况会复杂得多 - 当然.

Above we force the feature's install level to 0 because its condition of 1 is true (the number 1 is true in MSI logic - by definition - as in boolean). In the real world the condition would be something much more complicated - of course.

每个设置都有一个整体的INSTALLLEVEL - 正如 Chris Painter 在此解释的那样,它充当高水位标记.默认情况下,系统会默认安装评估为低于或等于 INSTALLLEVEL 的功能级别的每个功能.

Every setup has an overall INSTALLLEVEL - and it acts as a high water mark as explained here by Chris Painter. Every feature which evaluates to a feature level below or at the INSTALLLEVEL gets installed by default.

注意:当您在 WiX 源中将 Feature level 设置为 0 时,该功能不会显示在设置中GUI 而它不是将默认安装(更多详细信息在下面的链接中).

Note: When you set the Feature level to 0 in your WiX source, the feature is not show in the setup GUI and it is not going to be installed by default either (more details in link below).

功能操作可能非常复杂.几个链接:

Feature manipulation can be very involved. A few links:

  • How to install feature based on the property set in custom action?
  • Unselected Feature Being Installed (over the top detailed)
  • Failing condition wix (Level=0 hides feature from GUI)
  • http://www.joyofsetup.com/2008/04/09/feature-states-in-component-conditions/

这篇关于如何根据wix中的条件设置特征级别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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