我想根据安装的IIS有条件地部署文件。 每次部署它时,都会部署这两个功能。 请帮忙... 以下是代码片段的一部分......
<Product Id="*" Name="Patch Management" Language="1033" Version="1.0.0.0" Manufacturer="Start tech" UpgradeCode="739a025e-0758-4926-9528-2ad9a026e77a" Codepage="1252">
<Package Id="*" Compressed="yes" InstallScope="perMachine" Manufacturer="Star tech" Description="Server" Comments="(c)2016 Star tech" InstallPrivileges="elevated" AdminImage="yes"></Package>
<Property Id="IIS_MAJORVERSION">
<RegistrySearch Id="RS_IIS_MAJORVERSION_2" Root="HKLM" Key="SOFTWARE\Microsoft\InetStp" Name="MajorVersion" Type="raw">
</RegistrySearch>
</Property>
<Feature Id="ServerFeature" Title="Server Feature" Level="1">
<ComponentGroupRef Id="EXETXT_CMPGRP" />
<Feature Id="ServerSite" Title="Server Feature" Level="1">
<ComponentGroupRef Id="IISWEB_CMPGRP"/>
<Condition Level="0"><![CDATA[IIS_MAJORVERSION="#5"]]]></Condition>
</Feature>
<Feature Id="ServerSiteIIS5" Title="Server Feature IIS5 " Level="1">
<ComponentGroupRef Id="IISWEB_CMPGRP_5"/>
<Condition Level="0"><![CDATA[IIS_MAJORVERSION<>"#5"]]]></Condition>
</Feature>
</Feature>
</Product>
答案 0 :(得分:0)
我认为这种情况正在发生,因为您在父功能下嵌入了功能。
要素元素的InstallDefault属性有3个值。我认为默认值是followParent,因此无论其中的条件如何,都强制安装这些功能。我认为你可以通过将InstallDefault设置为source或local来解决这个问题(我未经测试,你必须测试这个,如果有人可以做评论!)或者不要将这些功能嵌套在一起。除非您在安装UI中显示功能树,否则无论您的所有功能是否在一起,它都不会对用户产生影响。您还可以使用&lt; FeatureGroup&gt;将功能组合成逻辑单元。元件。