Building VS 2008 projects with TFS 2005

Buck Hodges

The question has come up a couple of times as to how to get a TFS 2005 build agent (the build agent is the service running on the computer) to build a Visual Studio 2008 solution.  When you try to do it, you get the following error.

Solution file error MSB5014: File format version is not recognized.  MSBuild can only read solution files between versions 7.0 and 9.0, inclusive.

The TFS 2005 build agent finds msbuild.exe by asking the common language runtime (CLR) for its installing directory.  In VS 2008, the .NET framework version is 3.5, but the CLR remains at 2.0.  The result is that the code in TFS 2005 always finds msbuild.exe in the 2.0 .NET framework directory.  Since msbuild 2.0 does not recognize the version number in VS 2008 solution files, which was changed to 10.0, it produces the error message shown above.

The TFS 2008 build agent will not work with a TFS 2005 server (application tier) because the communication protocol and the information required to run the build changed quite a bit.  As a result, you can’t use a TFS 2005 server together with a TFS 2008 build agent.  We’ve actually included a setting in the TFS 2008 build agent that allows you to specify the path to msbuild.exe to deal with this issue in the future.

I’ll start by saying that I think the best “workaround” is to upgrade to TFS 2008.  There are lots of good reasons to do it, including lots of new features, performance improvements across the product, and a lot of bug fixes.  TFS 2008 is a significant improvement over TFS 2005 in all respects.  Having said that, I know not everyone is going to upgrade their servers immediately.

The best workaround that I’ve seen is to create a “shim” msbuild.exe in the .NET 2.0 directory that invokes the msbuild.exe in the .NET 3.5 directory.  Mitch Denny posted this approach and the code to go along with it.

Building .NET 3.5 Applications with Team Build 2005

What I needed to do was create a program called MSBuild.exe which I could drop in on top of the .NET 2.0 version of MSBuild that simply took the arguments passed to it and call the .NET 3.5 version of MSBuild. It ended up being about 25 lines of code in a single mainline.

more…

MSBuild 3.5 will also build Visual Studio 2005 solutions with the 2.0 toolset, so you should be able to build either VS 2005 or VS 2008 solutions with this workaround.

0 comments

Leave a comment

Feedback usabilla icon