【问题标题】:Howto use configurable Merge Modules in Wix?如何在 Wix 中使用可配置的合并模块?
【发布时间】:2010-01-19 07:08:40
【问题描述】:

AFAIK 是这样完成的:

产品:

<Merge Id ="HelpInstaller" SourceFile="HelpInstaller.msm" Language="1033" DiskId="1">
                <ConfigurationData Name="SurpressInstallation_Config" Value="&amp;HelpFeature"/>
 </Merge>

合并模块:

<Property Id="SupressInstallation" Value='0'  />

<Substitution Table='CustomAction' Row='SetSupressInstallationProperty' Column='Target' Value='[=SupressInstallation_Config]'/>
<CustomAction Id='SetSupressInstallationProperty' Property='SupressInstallation'      Value='[SupressInstallation]'/>  
<InstallExecuteSequence>
  <Custom Action='SetSupressInstallationProperty' Before='RegisterHelp' />
  <Custom Action='RegisterHelp' After='CostFinalize'>(NOT Installed) AND (NOT UPGRADINGPRODUCTCODE) AND SupressInstallation = 3) </Custom>
</InstallExecuteSequence>

但是当我像上面那样做时,我得到一个错误: 遇到“msmErrorDataRequestFailed”类型的意外合并错误,目前没有要显示的错误消息。

谁能告诉我如何解决这个问题?我基本上想做的是仅在选择某个功能时才在合并模块中执行自定义操作。这是正确的方法吗?谢谢丹尼尔

【问题讨论】:

    标签: installation wix windows-installer wix3


    【解决方案1】:

    你必须在模块下定义配置节点:

    <Property Id="SupressInstallation" Value='0'  />
    <Configuration Name="SupressInstallation_Config" Format="Text"/>
    <Substitution Table='CustomAction' Row='SetSupressInstallationProperty' Column='Target' Value='[=SupressInstallation_Config]'/>
    <CustomAction Id='SetSupressInstallationProperty' Property='SupressInstallation'      Value='[SupressInstallation]'/>  
    <InstallExecuteSequence>
      <Custom Action='SetSupressInstallationProperty' Before='RegisterHelp' />
      <Custom Action='RegisterHelp' After='CostFinalize'>(NOT Installed) AND (NOT UPGRADINGPRODUCTCODE) AND SupressInstallation = 3) </Custom>
    </InstallExecuteSequence>
    

    【讨论】:

      【解决方案2】:

      这听起来像是一个错误。您至少应该得到一个更具描述性的错误消息,解释出了什么问题。请随时将错误提交至http://wixtoolset.org/bugs

      【讨论】:

        【解决方案3】:

        功能依赖于合并模块,而不是相反。合并模块中的任何内容都不应引用合并模块之外的任何内容,例如 ProductName、ProductCode 或功能名称,因为这会将合并模块与特定产品紧密耦合,而不是成为通用的可重用模块。这样做基本上会创建一个循环引用,而不是想法。

        您可能需要(在不了解更多信息的情况下很难说)是使用合并模块中组件之一的操作状态来满足您的条件。

        例如,如果 component1 有 file1,并且您需要在安装此组件/文件时触发 customaction1,那么您将使用以下表达式:

        $component1=3 //INSTALLSTATE_LOCAL

        这样,如果此合并模块被合并到具有功能名称 A、B 或 C 的 Product1、Product 2 或 Product3 中,则无关紧要,因为关联是在组件级别。

        如果您尝试绑定的功能是不同的功能,那么这一切都需要移动到另一个合并到该功能中的合并模块中。您可能需要创建一个虚拟组件来关联。

        现在,如果您想忽略所有这些建议,请查看 Feature Action 状态运算符并紧密耦合。

        Conditional Statement Syntax

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2018-10-06
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多