如何安装依赖于条件的功能

时间:2014-12-16 12:58:20

标签: wix windows-installer

如果条件为真,我尝试安装功能。

根据教程,它应该像这样工作:

<Feature Id='ParentFeature' Id='Default'
         Title='Wix Sample App'
         Description='The complete package of Wix Sample App.'
         Display='expand'
         Level='1'
         ConfigurableDirectory='INSTALLDIR'>

  <Feature Id='ChildFeature' Title='AppConfig Internal' Level='1'>
    <ComponentRef Id='MyApp.exe' />
  </Feature>

  <!-- This is the conditional feature  -->
  <Feature Id='OptionalChildFeature' Title='AppConfig Internal' Level='0'>
    <ComponentRef Id='MyApp.exe.config' />
    <Condition Level='1'><![CDATA[TRUE]]></Condition>
  </Feature>
</Feature>

我的示例导致没有安装可选功能,但我希望它能够安装。

我使用的资源:

更新

我试图制作一个没有效果的原型。终于工作了,我可以在之前的步骤中找出问题(未正确设置属性)。

1 个答案:

答案 0 :(得分:1)

你是&#34; TRUE&#34;没有意义。 TRUE将是一个名为TRUE的公共财产。据推测,没有任何东西将其设置为具有值,因此条件评估为false,因此该功能保留在InstallLevel 0并且未安装。