How to use MSBuild for your WiX projects without installing Votive or Visual Studio

I got an interesting question today from a person reading my blog, so I thought I'd answer the question here in case other people have a similar interest.

 

The question was how to enable MSBuild support for a WiX project without having Votive or Visual Studio 2005 installed. The scenario is that this person uses Vista for his build environment and does frequent upgrades to the OS. He doesn't want to have to install Visual Studio 2005 every time he repaves his machine to just get his WiX projects to compile. Fortunately, this scenario is supported.

 

Basically, you have to do some very minor manual configuration of the WiX MSBuild tasks if you want to use MSBuild and WiX without installing Votive or Visual Studio. The key is to have the WixTasks.dll and wix.targets files copied to Program Files\MSBuild\Microsoft\WiX\v3.0 directory. You can now create an MSBuild file to compile/link your WiX projects. At the end of your file you should add the following line:

 

   <Import Project="$(MSBuildExtensionsPath)\Microsoft\WiX\v3.0\wix.targets" />

 

The other alternative is to use the new Votive that will be released very shortly (within the next couple of weeks). The new Votive has support for MSBuild by having the .wixproj file be a native MSBuild file. You could use Votive to create the .wixproj file for you with all of the various options you want for the compiler/linker and then just use that file on the build machine without installing VS 2005 or Votive.

 

Hope this helps. I will probably also put a sample .wixproj file up here in a future blog so you can see what it would look like to manually create a .wixproj (or whatever extension you want to use) MSBuild file.