1
votes

I am trying to extend our existing Wix Project with Heat to include all files from the output directory of another project in the installer. Somehow I`m missing something that should be very easy since I guess this is a very common task.

Here is what the solution looks like:

SomeDependencyA.csproj
SomeDependencyB.csproj (Depends on SomeDependencyA)
WindowsService.csproj (Depends on SomeDependencyB)
Installer.wixproj(Depends on WindowsService.csproj)

Wix should basically grep anything from WindowsService Output folder and build the msi package from it. The process should be:

  • Build all Dependencies
  • Build WindowsService project
  • Generate a Fragement using Heat
  • Build the Installer

And here is my question: Where/how do I have to include the call to Heat? Pre-Build Step and BeforeBuild Target does not work, since at this time the WindowsService and the Dependencies are not Build yet. AfterBuild wouldn´t help, since at that point the generated Fragment would not be cosidered anymore. I was looking for some build target that is calles AFTER all dependencies have been build but BEFORE the Installer Project itself has been build. Should be easy, but I couldn´t figure it out yet.

1

1 Answers

2
votes

The BeforeBuild target will happen potentially before a dependant project has completed its build.

A solution I've used for this type of build ordering in the past is to add a DependsOnTargets for the BeforeBuild target;

For csproj:

<Target Name="BeforeBuild" DependsOnTargets="ResolveReferences">  

For vcxproj:

<Target Name="BeforeBuild" BeforeTargets="PrepareForBuild">

This will force the project to wait until the dependant projects are completed before running the BeforeBuild target.