【问题标题】:Wix conditionally deploy fragmentWix 有条件地部署片段
【发布时间】:2016-05-04 10:36:25
【问题描述】:

我想根据安装的 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>

【问题讨论】:

    标签: wix windows-installer wix3


    【解决方案1】:

    我想这是因为您将功能嵌入到父功能下。

    特征元素的InstallDefault 属性有3 个值。我认为默认值是 followParent,因此无论其中的条件如何,都必须强制安装这些功能。我认为您可以通过将 InstallDefault 设置为源或本地来解决此问题(未经我测试,您必须对此进行测试,如果可行,请发表评论!)或者不要将功能相互嵌套。除非您在安装 UI 中显示功能树,否则无论您的所有功能是否在一起,都不会对用户产生影响。您还可以使用 元素将您的功能组合成一个逻辑单元。

    【讨论】:

      猜你喜欢
      • 2021-02-16
      • 1970-01-01
      • 2018-09-18
      • 2023-03-29
      • 2014-11-04
      • 1970-01-01
      • 1970-01-01
      • 2019-06-17
      • 1970-01-01
      相关资源
      最近更新 更多