如何在Wix中使用可配置的合并模块?

发布于 2024-08-18 16:54:50 字数 1118 浏览 7 评论 0原文

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”的意外合并错误,当前没有可显示的错误消息。

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

AFAIK it's done like this:

Product:

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

Merge Module:

<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>

But when i did it like above i get an error:
Encountered an unexpected merge error of type 'msmErrorDataRequestFailed' for which therer is currently no error messagte to display.

Can anyone tell me howto solve that problem? What i basically want to do is to execute a custom action in the merge module only when a certain feature is selected..Is this the right way to do it? Thanks Daniel

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

浊酒尽余欢 2024-08-25 16:54:50

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

<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>

You have to define Configuration node under module:

<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>
愁以何悠 2024-08-25 16:54:50

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

That sounds like a bug. You should at least get a more descriptive error message explaining what went wrong. Feel free to file the bug at http://wixtoolset.org/bugs

怎言笑 2024-08-25 16:54:50

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

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

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

$component1=3 //INSTALLSTATE_LOCAL

这样,如果此合并模块合并到 Product1、Product 2 或产品 3 的功能名称为 A、B 或 C 并不重要,因为关联是在组件级别的。

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

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

条件语句语法

A feature has a dependency on a merge module, not the other way around. Nothing in the merge module should have a reference to anything outside of the merge module such as a ProductName, ProductCode or Feature name because that would tightly couple the merge module to a specific product rather then being a generic reusable module. Doing such would essentially create a circular reference and is not idea.

What you probably need ( hard to say without knowing more information ) is to use the action state of one of the Components in the merge module for your condition.

For example if component1 has file1 and you need customaction1 to fire when this component/file is being installed then you'd use an expression of:

$component1=3 //INSTALLSTATE_LOCAL

That way if this merge module gets merged into Product1, Product 2 or Product3 with Feature Name A, B or C it won't matter because the association is at the component level.

If the feature you are trying to tie off of is a different feature then this all needs to be moved into a different merge module that get's merged into that feature. You might need to create a dummy component to associate to.

Now if you want to ignore all of this advice, then look at the Feature Action state operator and tightly couple away.

Conditional Statement Syntax

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文