Aaron has written a great post on using Visual Studio (devenv) from within Team Build as part of the build process.  If that sounds strange, it's necessary because there are projects that Visual Studio can build, but msbuild cannot.  Projects in this category include Visual Studio setup projects (.vdproj), SQL Reporting Services (SRS), and BizTalk.  Some projects may never be supported outside of msbuild, as is the case with the setup projects (WiX works msbuild, if you want a setup technology that doesn't rely on Visual Studio).

We have documentation, such as this walkthrough on building setup projects, showing you how to run devenv by using the Exec task in msbuild, but this approach has shortcomings.  You don't get any details in the build report.  The syntax is confusing to read with all of the quotation marks, some of which must be escaped.  But the most subtle aspect, and Aaron discovered this in the course of writing is his post, devenv rebuilds the whole solution to another directory, resulting in a different set of binaries being packaged in your setup output.

To address this, he has written a custom msbuild task that wraps devenv.  In the post he shows you how to use it, and for those who are interested, he describes how it works.  Both the compiled assembly and the source code are attached to the post.  Note that this task only works for TFS 2008 (Orcas) and not TFS 2005 (v1).

Team Build DevEnv Task

Because many Visual Studio project types are not supported in MSBuild, many Team Build users end up needing to invoke DevEnv directly.  There is a fair amount of confusion about how to do this best / simplest - I've written two posts (here and here) on the issue already! 

As such, I thought it would be helpful to write a DevEnv task that could be used to invoke DevEnv from MSBuild during the course of a Team Build build, along with some guidance on how to use it best.  I'll go through how to use the attached DLL for those who just want to use the task, go into a few chunks of the source code for those interested in how the task works, and then go through an example of how to use the task to build a setup project (*.vdproj).  A note for the lawyers: I can make no guarantees as to the awesomeness of this task or lack thereof - it is provided "as is" with no warranties and confers no rights. 


While this task isn't going to be part of Orcas (TFS 2008), we'll add it to the TFS power tools once we get some feedback.

Enjoy and let us know what you think!

tags: , , , , , , , ,