One of the most common reasons for using MSBuild with WiX project files is to integrate the build of an installer into an existing daily build process. This is often coupled with a need to build WiX projects without having to pre-install any WiX tools on the daily build machine. WiX projects and the WiX tools to build them can be added to most daily build processes that support MSBuild using a few simple steps.
To avoid having to install WiX on build machines you can check all the tools necessary to build WiX projects into your source code control system. Here's how:
After checking the WiX tools into source code control the .wixproj file must be modified to point to the location of the checked in tools. Open the .wixproj file in any text editor, such as Visual Studio, and add the following to the file anywhere between the <Project> element before the <Import> element:
<PropertyGroup> <WixToolPath>$(SourceCodeControlRoot)\wix\[[Version]]\</WixToolPath> <WixTargetsPath>$(WixToolPath)Wix.targets</WixTargetsPath> <WixTasksPath>$(WixToolPath)wixtasks.dll</WixTasksPath> </PropertyGroup>
The WixToolPath must be set to point to the location of the WiX tools directory created in Step 1. The method used to reference the location will vary depending on your build system, but common choices are an MSBuild property that is set via an environment variable (such as $(BinariesRoot) in a Team Foundation Server build) or a custom property passed in on the command-line.
You can also use a relative path to the directory (such as ..\..\tools\), but note that the WixTargetsPath property value must be relative to the .wixproj project file that uses it. The WixTasksPath property is used inside wix.targets to load WixTasks.dll; its value, if a relative path, must be relative to the wix.targets file. Those two files usually live together, so the value would be WixTasks.dll with no extra path information.
Note that WixToolPath must end in a backslash.