Wix组件条件

Dre*_*dan 2 installer windows-installer wix

我正在尝试让条件组件工作.

然而,它根本不起作用,所以我很难过.

我有以下blob代码:

该功能定义如下:

<Feature Id="MainFeature" Level="1" Title="!(loc.FEATURE.MAINFEATURE.TITLE)" 
         Description="!(loc.FEATURE.MAINFEATURE.DESCRIPTION)" Display="collapse">
      <ComponentRef Id="MainExecutable" />
      <ComponentRef Id="pmd" />
</Feature>
Run Code Online (Sandbox Code Playgroud)

并且组件定义为

<Component Id="MainExecutable" Guid="*">
 <Condition><![CDATA[(&MainFeature = 3) AND NOT (!MainFeature = 3)]]></Condition>
    <File Id="MainExecutableFile" Name="SampleApp.exe" 
          Source="..\ProductBuild\sampleFile.txt" KeyPath="yes">
     <Shortcut Id="MainExecutableStartMenu" Directory="ProgramMenuDir" 
               Name="!(loc.APPNAME)" WorkingDirectory="INSTALLDIR" 
               Icon="icon.ico" IconIndex="0" Advertise="yes"/>
     <Shortcut Id="MainExecutableDesktop" Directory="DesktopFolder" 
               Name="!(loc.APPNAME)" WorkingDirectory="INSTALLDIR" 
               Icon="icon.ico" IconIndex="0" Advertise="yes" />
    </File>
</Component>
Run Code Online (Sandbox Code Playgroud)

但是文件永远不会安装!

Rob*_*ing 6

Component Condition在确定特征状态时不评估A. 因此,你的Condition遗嘱永远不会得到正确的评价(正如你所发现的那样).

但是,我不确定你是否需要Condition.只有在将其父功能设置为安装时才会安装组件.看起来你Condition正试图复制内置行为(但由于上述原因,不能).