You can either assign your source paths to .wixproj in DefineConstants, or you can assign them in the WIX include file, but in any case you will have to use the "var" option to specify the variable used for your sources.
If you want to use DefineConstant in wixproj, you will need to do something like
<Target Name="BeforeBuild"> <PropertyGroup> <DefineConstants>BINFOLDER=..\PATH\TO\SOURCE\$(Configuration)</DefineConstants> </PropertyGroup> <HeatDirectory OutputFile="output.wxs" Directory="..\PATH\TO\SOURCE\$(Configuration)" DirectoryRefId="INSTALLFOLDER" ComponentGroupName="COMPONENTGROUPNAME" ToolPath="$(WixToolPath)" PreprocessorVariable="var.BINFOLDER" /> </Target>
In the Heat task, make sure that you add additional attributes that you may need. If you added a link to your source project in .wixproj, you can directly use the project reference variables in the "PreprocessorVariable" attribute. For example, instead of var.BINFOLDER, use var.MyProject.TargetDir.
If you want to use the WIX include file (.wxi), then declare the variables in the include file, for example Variables.wxi:
<?xml version="1.0" encoding="UTF-8"?> <Include> <?define PATH1="PATH\TO\SOURCE"?> <?define PATH2="$(var.PATH1)\$(Configuration)"?> </Include>
Now you will need to go to PATH1 and PATH2 using -var on the heat command line. Once you have your .wxs file, you will need to include the Variables.wxi file using
<?include Variables.wxi ?>
in your .wxs. The problem is that you will either have to add this include directive manually each time you create the WIX source files, or you will have to enter it using XSL Transformation.
sttaq source share