WiX:加热如何在命令行中使用自定义变量

WiX: heat how to use custom variable in command line

我正在使用这个加热命令

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' 属性中声明的路径中没有找到任何文件。

如何使用 'Path' 变量值作为 'Source' 属性?

谢谢

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

来自热量用法:

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

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

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

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

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

这是工具设置 window 的屏幕截图:

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