如何将 heat.exe 与 Visual Studio 扩展一起使用?

问题描述 投票:0回答:1

Wix 工具集(v.3)有一个名为 heat.exe 的工具,用于“收获”特定位置的文件并生成 .wxs 文件,该文件指定将成为安装程序包一部分的文件。

我们当前的 Wix 代码使用热量来收集我们的应用程序文件,但现在我尝试在安装程序的 Visual Studio 项目中进行设置,该项目使用 Wix v3 Visual Studio 2022 扩展。

如何与 Visual Studio 项目结合使用?这还有道理吗?

或者我应该简单地手动运行一次 heat,然后将生成的 .wxs 作为源文件包含在项目中?

visual-studio wix heat
1个回答
0
投票

wix.targets中有一个构建任务HeatDirectory。下面应该提示您如何在 wixproj 文件中使用它。

<PropertyGroup>
  <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">C:\Program Files (x86)\MSBuild\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
</PropertyGroup>
...
<!-- Add compile heat output file -->
<Compile Include="MyStuff.wxs" />
...
...
<Import Project="$(WixTargetsPath)" />
<Target Name="HarvestMyStuff" BeforeTargets="BeforeBuild">
  <!-- Create source variable accessible in your wix project files -->
  <CreateProperty Value="$(CompilerAdditionalOptions) -dMyStuffSourceDir=&quot;..\Path\To\My\Stuff&quot;">
    <Output TaskParameter="Value" PropertyName="CompilerAdditionalOptions" />
  </CreateProperty>
  <!-- Configure and execute heat -->
  <HeatDirectory OutputFile="$(ProjectDir)\MyStuff.wxs" Directory="..\Path\To\My\Stuff" ComponentGroupName="MyStuffFiles" DirectoryRefId="MyStuffFilesTargetDir" PreprocessorVariable="var.MyStuffSourceDir" GenerateGuidsNow="true" SuppressRegistry="true" SuppressRootDirectory="false" ToolPath="$(WixToolPath)" KeepEmptyDirectories="true" NoLogo="true" />
</Target>

HeatDirectory 文档

© www.soinside.com 2019 - 2024. All rights reserved.