Reputation: 364
The Wix toolset (v.3) has a tool called heat.exe for "harvesting" files in a particular location and generating a .wxs file which specifies the files which will be part of an installer package.
Our current Wix code uses heat to harvest our application files, but now I am trying to set this up in a Visual Studio project for the installer, which uses the Wix v3 Visual Studio 2022 extension.
How do I get heat working in in conjunction with a Visual Studio project? Does that even make sense?
Or should I simply run heat once, manually, and then include the generated .wxs in the project as a source file?
Upvotes: 0
Views: 725
Reputation: 564
There is a build task HeatDirectory in wix.targets. The following should give you a hint how to use it in your wixproj file.
<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="..\Path\To\My\Stuff"">
<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>
Upvotes: 0