Building VS 2008 projects with TFS 2005


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.

Comments (9)

  1. Alek says:

    Your solution works, but cannot run any tests defined in VS2008 – just doesn’t understand 2008 vsdmi file. Had anyone found a workaround for that too?

  2. buckh says:

    Alek, since the VSMDI file format did change, you would need to have VSTS for Testers or VSTS Suite installed on the build computer so that it can run the 2008 version of mstest.exe to execute the tests.

    Buck

  3. El Bruno says:

    Buenas, cómo había comentado hace 2 días , el completo FAQ para la instalación y administración de TFS

  4. El Bruno says:

    Buenas, cómo había comentado hace 2 días , el completo FAQ para la instalación y administración de TFS

  5. 這個問題在昨天也有朋友問到。預設您無法在 Team Foundation Server 2005 中建置 VS 2008 的專案,若您的 Team Foundation Server 無法升級到 2008

  6. こんにちは! フォーラム オペレーターの服部清次です。 皆さん、来週月曜日からもう 12 月ってご存知でしたか? 泣いても笑っても、いよいよ 2008 年最後の月がやって来ます。 年始に立てた目標がまだ達成できていない皆さん、これまでのところ

  7. Geetha says:

    Can you please post me the code for the new MSbuild.exe which will build .net 3.5 framework in TFS 2005. I will really appreciate your help on this.

    Thanks,

    Geetha

  8. buckh says:

    Geetha, if I understand your question correctly, the code you want is in the blog post that I reference above, which is http://tfsnow.wordpress.com/2007/08/31/building-net-35-applications-with-team-build-2005/.

    Buck

  9. Jonathan says:

    No, Amaresh is incorrect, simply adding to the path does not fix this, I’ll comment that here to save others wasting time trying it out!

Skip to main content