Micha Wiedenmann
Micha Wiedenmann

Reputation: 20873

PreBuildEvent vs HeatDirectory in a WiX .wixproj file

What is the relationship between PreBuildEvent and HeatDirectory in .wixproj file?

To call heat.exe I have configured a pre-build event:

  <PropertyGroup>
    <PreBuildEvent>"$(WIX)bin\heat.exe" dir "$(SolutionDir)\Source" ^
                       -var var.SourceDir ^
                       -dr INSTALLFOLDER ^
                       -cg MyComponents ^
                       -ag -ke -scom -sfrag -srd -sreg -suid -svb6 ^
                       -o "$(ProjectDir)MyComponents.wxs"</PreBuildEvent>
  </PropertyGroup>

However there is also the HeatDirectory element:

<!-- To modify your build process, add your task inside one of the
     targets below and uncomment it. Other similar extension points
     exist, see Wix.targets.
<Target Name="BeforeBuild">
  <HeatDirectory ... >
  </HeatDirectory>
</Target>
<Target Name="AfterBuild">
</Target>
-->

What is the relationship and which one should I use?

Upvotes: 2

Views: 1391

Answers (1)

Arkady Sitnitsky
Arkady Sitnitsky

Reputation: 1886

Both are the same.

The Prebuild event calls directly the heat process in order to generate automatically MyComponents.wxs file.

And the before build target doing the same when using "HeatDirectory" or "HarvestDirectory".

The main difference is which of this option is more sutible for you. Command line,as you described above, or xml style like:

  <HarvestDirectory Include="$(SourceDir)">
    <DirectoryRefId>INSTALLDIR</DirectoryRefId>
    <ComponentGroupName>cmpMain</ComponentGroupName>
    <PreprocessorVariable>var.SourceDir</PreprocessorVariable>
    <SuppressUniqueIds>false</SuppressUniqueIds>
    <SuppressCom>true</SuppressCom>
    <SuppressRegistry>true</SuppressRegistry>
    <SuppressRootDirectory>true</SuppressRootDirectory>
    <KeepEmptyDirectories>false</KeepEmptyDirectories>
    <Transforms>DefaultTransform.xsl</Transforms>
  </HarvestDirectory> 

Upvotes: 1

Related Questions