WiX Heat: Pre-build event fires too early on build server

OK so I've spent hours to figure out how to fire Heat AFTER all references are resloved. I only found solutions for the <PreBuildEvent> and <PostBuildEvent> using the Heat command line and the BeforeBuild and AfterBuild targets.

So I found all kind of targets inside the wix2010.targets file located in my Program files (x86)\MSBuild\Microsoft\Wix\ folder. It contains a target called AfterResolveReferences and it does exactly that. So here's my code I ended up with (in case someone is interested):

<Target Name="AfterResolveReferences">
    <HeatDirectory
        ToolPath="$(WixToolPath)"
        OutputFile="Product.Binaries.wxs"
        SuppressFragments="$(HarvestDirectorySuppressFragments)"
        Transforms="Filter.xslt"
        Directory="$(HarvestFolder)"
        DirectoryRefId="MY_FOLDER"
        ComponentGroupName="Binaries"
        GenerateGuidsNow="true"
        SuppressRootDirectory="true"
        SuppressRegistry="true"
        PreprocessorVariable="var.App.TargetDir">
    </HeatDirectory>
</Target>

Tags:

Msbuild

Wix

Heat