0

I'm using heat in a wix installer. At first I tried it with no properties and it worked like a charm. I added the heat command to the pre-build event and added the sourceDir declaration to the linker. Now I would like to pass properties to the wix in order to harvest different folders. The properties are passed just fine to the wxs file, e.g. Version="$(var.PRODUCTVERSION)", but it cannot be used in the pre-build event or in the linker params, e.g. "%wix%\bin\heat.exe" dir "$(var.FOLDER)\work\" -cg Files -dr INSTALLFOLDER -gg -scom -sreg -sfrag -srd -out "FilesHeat.wxs".

Any ideas??

Lipo
  • 75
  • 2
  • 8

1 Answers1

0

You can unload your wix project and add below code at last

<Import Project="$(WixTargetsPath)" />

<Target Name="BeforeBuild">
    <HeatDirectory NoLogo="True" ToolPath="$(Wix)\bin" GenerateGuidsNow="True" OutputFile="$(MSBuildProjectDirectory)\Cmp_Gp_SQLFiles.wxs" Directory="..\_Dependencies\SQL" ComponentGroupName="Cmp_Gp_SQLFiles" DirectoryRefId="DIR_Sql" PreprocessorVariable="var.SQLFolder" SuppressFragments="True" SuppressUniqueIds="True" SuppressCom="True" SuppressRootDirectory="True" SuppressRegistry="True" RunAsSeparateProcess="True" />
</Target>

Save file.And build the project.

It will make Cmp_Gp_SQLFiles.wxs file as below:

<Fragment>
 <DirectoryRef Id="DIR_Sql">
  <Component Id="sample.sql" Guid="PUT_GUID_HERE">
    <File Id="sample.sql" KeyPath="yes" Source="$(var.SQLFolder)\sample.sql" />     
  </Component>
    ...      
</DirectoryRef>

<Fragment>
  <ComponentGroup Id="Cmp_Gp_SQLFiles">
    <ComponentRef Id="sample.sql" />
    ...      
  </ComponentGroup>
</Fragment>

If you dont want the file id to be same as filename, put SuppressUniqueIds=false.

Make changes according to your requirements.

Ashish Kamat
  • 567
  • 4
  • 16