【问题标题】:WiX - using property within a propertyWiX - 在属性中使用属性
【发布时间】:2016-08-03 21:15:34
【问题描述】:

我有一个 WiX 3.10 安装程序,它为现有应用程序安装附加模块。出于这个原因,我使用 RegistrySearch 来获取应该放置插件的安装文件夹。之后,必须使用一些参数执行同一目录中已经存在的(意味着这是基本应用程序的一部分,而不是附加组件)实用程序。

我试过了:

    <Property Id="INSTALLFOLDER">
      <RegistrySearch Id='InstallPathRegistry' Type='raw' Root='HKLM' Key='SOFTWARE\Vendor\Application' Name='InstallPath' Win64='no'/>
    </Property>

    <Condition Message="Application installation folder not found.">
      <![CDATA[Installed OR INSTALLFOLDER]]>
    </Condition>

    <Property Id="WixQuietExecCmdLine" Value="RegAddOn.exe /f [INSTALLFOLDER]\Addon.RegFile" />
    <CustomAction Id="QtExec" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="immediate" Return="check" />




<InstallExecuteSequence>
  <Custom Action="QtExec" OnExit="success"/>
</InstallExecuteSequence>

很遗憾,[INSTALLFOLDER] 未解决。显然,我也收到了一个编译器警告。

如何解决该属性?

【问题讨论】:

    标签: wix windows-installer


    【解决方案1】:

    您的警告说明了该怎么做:

    Warning     The 'X1' Property contains '[X2]' in its value which is an illegal reference to another property.  If this value is a string literal, not a property reference, please ignore this warning.  To set a property with the value of another property, use a CustomAction with Property and Value attributes.
    

    注意:使用带有 Property 和 Value 属性的 CustomAction。

    所以你需要定义没有价值的属性

    <Property Id="WixQuietExecCmdLine" Value=" " />
    

    并使用自定义操作来填充它

    <CustomAction Id="SetProp" Property="WixQuietExecCmdLine" Value="RegAddOn.exe /f [INSTALLFOLDER]\Addon.RegFile"></CustomAction>
    

    并在您当前的自定义操作之前运行它

    <InstallExecuteSequence>
      <Custom Action="SetProp" OnExit="success"/>
      <Custom Action="QtExec" After="SetProp"/>
    </InstallExecuteSequence>
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-15
    • 2018-05-15
    • 1970-01-01
    相关资源
    最近更新 更多