共用方式為


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.

Comments

  • Anonymous
    August 15, 2006
    Hi Justin,

    I just ran into Wix and Votive and I have a question.

    Is it already (or will it be) possible to use WiX together with Team Foundation Build in order to automate MSI creation? If so, how would I set it up?

    Cheers,

    Anders
  • Anonymous
    August 16, 2006
    Anders,

    Yes this scenario should be supported as soon as the new Votive code gets checked in, which should happen within the next week or two. I haven't actually tried it yet, but from what I understand, you basically just have to have an MSBuild-compliant project file, which .wixproj will be (after the check in).

    Basically, you'll use Votive to create your .wixproj file and then you can have the Team Foundation Build server use that file to automate your MSI creation.

    Thanks,
    Justin