【问题标题】:WiX: heat how to use custom variable in command lineWiX:加热如何在命令行中使用自定义变量
【发布时间】:2016-08-24 15:34:26
【问题描述】:

我正在使用这个加热命令

heat dir "$(SolutionDir)scr\A\A.WindowsService\bin\$(Configuration)" -dr ConfigurationUtilityDir -gg -g1 -cg ConfigurationUtilityComponents -sf -spdb -xo -srd  -out "$(SolutionDir)scr\Installers\A\AInstallerHeat\ConfigurationUtilityHeat.wxs" -dPath="C:\..\A\A.WindowsService\bin\Release -var var.Path

但似乎 heat 忽略了 'Path' 变量和 -var 参数的声明。所以它会生成一个这样的文件

<Component Id="cmpBBD96B447087B68960C29FA13E08DCA2" Directory="dir5624AEB1C4C7EFEEFB6B6016AAE1AD54" Guid="B71EF27A-2812-4698-BDA9-8ABC8C44C8F7">
   <File Id="fil8D456C6334925F4FE3A7B8A8A5D76ABB" KeyPath="yes" Source="SourceDir\bin\A.dll" />
</Component>

显然,它无法创建最终的 .msi 包,因为它在 'Source' 属性中声明的路径中找不到任何文件。

如何将“路径”变量值用作“源”属性?

谢谢

编辑:我也尝试使用 -b C:\..\A\A.WindowsService\bin\Release 而不是定义自定义变量,但它仍会在“SourceDir..”目录中查找文件

【问题讨论】:

    标签: wix windows-installer heat


    【解决方案1】:

    我将解释如何使用 Visual Studio 实现您的要求,也许这会帮助您找到解决方案。

    1. 在我的 heat 命令中,我指定 -var wix.Path,而不是 -var var.Path
    2. 在我的 Visual Studio 项目属性的工具设置窗口中,我在链接器选项中指定 -dPath=..\someRelativePath

    heat.exe 生成源时,指定的路径现在为Source="!(wix.HelpSource)\filename.dll" 形式

    以下是“工具设置”窗口的屏幕截图:

    注意:在另一个答案中提到,在运行heat.exe时,指定的最后一个参数是输出文件-out sourceFile.wxs

    【讨论】:

    • 是否可以在链接器选项中以某种方式使用环境变量或 Pre-build/Post-build 宏值?
    【解决方案2】:

    从热量使用:

    usage:  heat.exe harvestType harvestSource <harvester arguments> -o[ut] sourceFile.wxs
    

    在 -o[ut] 参数之后不再解析任何参数。你有 -dPath... 和 -out 之后的 -var。

    【讨论】:

      猜你喜欢
      • 2023-03-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-28
      相关资源
      最近更新 更多