Wix 不会将 var.publishDir 插入 wxs 文件

Wix doesn't insert var.publishDir into wxs file

我正在使用 WiX 工具为我的应用程序创建安装程序

第一步包括获取一个目录,其中包含所有程序文件。这是我用来收集文件的命令:

heat dir "C:\myDir" -dr INSTALLFOLDER -ke -srd -cg WebComponents -var var.publishDir -gg -out WebSiteContent.wxs 

我得到 WebSiteContent.wxs 但不幸的是 var.publishDir 被评估为“C:\” 所以我最终得到一个包含错误文件路径的 .wxs 文件

在 .wxs 文件中,我希望路径如下所示:

$(var.publishDir).\relative\path\to\the\program\file

相反,这就是我得到的:

C:\relative\path\to\the\program\file

需要在Wixproj中定义DefineConstants来传递。

<PropertyGroup>
   <DefineConstants>
       $(DefineConstants);publishDir=$(publishDir)
   </DefineConstants>
</PropertyGroup>