【问题标题】:How to define a CustomAction with a long command line in WIX?如何在 WIX 中使用长命令行定义 CustomAction?
【发布时间】:2015-07-08 12:00:36
【问题描述】:

我在我的 wxs 文件中定义了一个自定义操作:

    <CustomAction ExeCommand="long command line" FileKey="xyz.exe" Id="foo"/>

我收到警告:

警告 LGHT1076:ICE03:字符串溢出(大于长度 列中允许);表:CustomAction,列:目标,键:

用长命令行定义操作的正确解决方案是什么?

【问题讨论】:

标签: wix windows-installer custom-action


【解决方案1】:

经过很多次我找到了解决方案。我将命令行拆分为多个属性。

<CustomAction Id="action.prop0" Property="prop0" Value="first part with [INSTALLDIR]"/>
<CustomAction Id="action.prop" Property="prop" Value="[prop0] second part"/>
<CustomAction ExeCommand="[prop]" FileKey="service.exe" Id="myaction"/>
<InstallExecuteSequence>
  <Custom Action="action.prop0" After="InstallFiles"/>
  <Custom Action="action.prop" After="action.prop0"/>
  <Custom Action="myaction" Before="InstallFinalize"/>
</InstallExecuteSequence>

【讨论】:

    【解决方案2】:

    将长命令行分配给属性,然后在自定义操作中使用 [PROPERTY]。尽管 EXE 自定义操作通常不受欢迎。如果您必须这样做,请使用 WiX Quiet Execute Custom Action 功能。

    【讨论】:

    • 如果我想设置一个属性,那么我会收到:警告 CNDL1077:该属性的值中包含“[INSTALLDIR]”,这是对另一个属性的非法引用。要使用另一个属性的值设置一个属性,请使用具有 Property 和 Value 属性的 CustomAction。 * 如果我使用 CustomAction,那么我遇到了原来的问题。
    • 在这种情况下,您需要使用在 InstallExecute 序列中的 CostFinalize 之后安排的 SetProperty 自定义操作。您必须在那之后才能使用该属性。
    • SetProperty 是 Property 类型的 CustomAction 的快捷方式。有相同的长度限制。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多