Wix:在具有不同条件的不同功能下添加相同的功能组ID会删除已添加的功能吗?

时间:2015-05-13 17:59:57

标签: wix windows-installer wix3.5

考虑以下.wxs

<Feature Id="Prod.Full" Level="1" Title="!(loc.FeatureAllFiles)">
  <Condition Level="0"><![CDATA[NOT((MYPRODINSTALLATIONTYPE ~= "FULL") OR (MYPRODINSTALLATIONTYPE ~=""))]]></Condition>
  <FeatureGroupRef Id="FeatureGroup.FullA"/>
  <FeatureGroupRef Id="FeatureGroup.FullB"/>
  <FeatureGroupRef Id="FeatureGroup.FullC"/>
</Feature>

<Feature Id="Prod.AddCompFree" Level="1" Title="!(loc.FeatureAdditionalFiles)">
  <Condition Level="0"><![CDATA[NOT((MYPRODINSTALLATIONTYPE ~= "FREE") OR (MYPRODINSTALLATIONTYPE ~=""))]]></Condition>
  <FeatureGroupRef Id="FeatureGroup.FullB"/>
</Feature>

想象一下,我用MYPRODINSTALLATIONTYPE = FULL运行msi

安装是否包含所有三个功能组(FeatureGroup.FullA,&#34; FeatureGroup.FullB,&#34; FeatureGroup.FullC)

将在安装中删除FeatureGroup.FullB吗?

1 个答案:

答案 0 :(得分:1)

简答:FeatureGroup.FullB将在安装中删除

长答案:运行CostInitialize / CostFinalize操作时,将按顺序处理Condition表:top - &gt;底部。

首先处理此行,条件为FALSE(没有功能设置为InstallLevel = 0)

<Feature Id="Prod.Full" Level="1" Title="!(loc.FeatureAllFiles)">
  <Condition Level="0"><![CDATA[NOT((MYPRODINSTALLATIONTYPE ~= "FULL") OR (MYPRODINSTALLATIONTYPE ~=""))]]></Condition>
  <FeatureGroupRef Id="FeatureGroup.FullA"/>
  <FeatureGroupRef Id="FeatureGroup.FullB"/>
  <FeatureGroupRef Id="FeatureGroup.FullC"/>
</Feature>

第二行处理此行,条件为TRUE(FeatureGroup.FullB具有InstallLevel = 0)

<Feature Id="Prod.AddCompFree" Level="1" Title="!(loc.FeatureAdditionalFiles)">
  <Condition Level="0"><![CDATA[NOT MYPRODINSTALLATIONTYPE ~= "FREE"]]></Condition>
  <FeatureGroupRef Id="FeatureGroup.FullB"/>
</Feature>