Nothing special needs to be done to build a WiX v3 project in Team Build.

All you need to do is:
  • Install a recent version of WiX on your build server
  • Install the same version of WiX on your development machine(s)
  • Add a *.wixproj project to your solution, and get Team Build to build it.

In WiX v3, the project file format was changed to be an MSBuild script (.wixproj). That means that it functions exactly like a .csproj or *.vbproj project in VS2005+.

This recipe shows you how you can make your WiX script more generic using preprocessor variables and not have to hardcode or guess file paths.

It works for Visual Studio (Ctrl-Shift-B) builds, Desktop Builds and Team Builds.

Where do I get WiX from?

I suggest downloading one of the recent weekly releases from here:

This is because the 'official' releases are quite stale and you miss out on important bugfixes.

Special Preprocessor Variables for file paths

If you include the WiX v3 project in your application's solution file, you can make use of these special preprocessor variables.

Most people start off by using relative paths in their *.wxs scripts to get to the binaries that MSBuild has just built.

The downside of this is that depending on how you call MSBuild, the output path can be quite different.

For example, if your application outputs MyApplication.exe it might go to any number of these locations:
  • \bin\Debug\MyApplication.exe
  • \obj\Debug\MyApplication.exe
  • \obj\Release\MyApplication.exe
  • or even ..\Binaries\Release\MyApplication.exe if you use Team Build

If you add a Project Reference from your WiX (Votive) project to the other projects, WiX makes available extra preprocessor variables for these projects. You can then do things like this:

     <!-- For a project with the project name MyApplicationProject -->
     <File Id="MyApplication"
           DiskId="1" />



Add to your WiX scripts (*.wxs).


Last edited Nov 2, 2010 at 6:06 PM by wbarthol, version 2


No comments yet.