Wix中特征选择树中的特征依赖性

DeC*_*Caf 6 wix wix3.9

如果在功能选择树中选择了其他功能,是否有任何方法可以强制安装特定功能?那是没有特征是他们的依赖的孩子?

abb*_*dev 2

是的,这应该是可能的,如果您在功能元素下使用条件元素,您可以根据条件控制功能安装级别。

    <Feature Id="MyDependentFeature">
      <Condition Level="1">(NOT INSTALLED AND &MyMasterFeature=3) OR (INSTALLED AND !MyMasterFeature=3)</Condition> 
    </Feature>

    <Feature Id="MyMasterFeature"> 
    </Feature>
Run Code Online (Sandbox Code Playgroud)

这里需要解释一些事情:

  • Condition Level="1"告诉 Wix 将父功能安装级别设置为 1(安装)(信息
  • (NOT INSTALLED AND &MyMasterFeature=3)如果产品尚未安装,并且 MyMasterFeature 请求的操作是安装
  • (INSTALLED AND !MyMasterFeature=3)如果产品已安装,且 MyMasterFeature 的安装状态为“已安装”。(信息