5
votes

I am using heat.exe to genrate file listing, I need to replace File/@Source="SourceDir" so I am passing -var and directory name , but those variable are defined in my .wxi file How can I include .wxi file in the heat generated wxs file . as this file will be generated each time i make a build.

2
I think I found another option to resolve this issue. Use -var and use the same on candle command line.Avinash

2 Answers

1
votes

Why replace SourceDir?

You can just pass in additional base folders to light with the -b switch and for all references of SourceDir, WiX will look in the base folders you've specified. Makes it easy to move things around between machines and only have to update a parameter in your build system, rather than editing an include file.

1
votes

An update for wix 3.7, when you use HeatDirectory task in your wixproj instead of running heat.exe, you can PreprocessorVariable to set the SourceDir.

<Target Name="BeforeBuild">
<HeatDirectory Directory="..\distribution"
               PreprocessorVariable="myVar"  <--- your variable name
               OutputFile="HeatGeneratedFileList.wxs"
               ComponentGroupName="HeatGenerated"
               DirectoryRefId="INSTALLFOLDER"
               AutogenerateGuids="true"
               ToolPath="$(WixToolPath)"
               SuppressFragments="true"
               SuppressRegistry="true"/>
</Target>

More detail:

http://wix.sourceforge.net/manual-wix3/msbuild_task_reference_heatdirectory.htm

WIX HeatDirectory Task - Setting the preprocessorVariable