Nov 12, 2009

How To Build VS2010 Solutions Using TFS2008 Team Build

So you’ve got your hands on a bright and shiny copy of Visual Studio 2010 Beta 2 and you want to switch your solutions and projects over to it but you don’t want to upgrade your existing TFS 2008 server to TFS 2010 Beta 2 yet because you’re not yet ready for that much change.  The obvious question is, if you change your solution and project formats over to VS2010 can you get them to build on your existing TFS2008 team build servers?

The answer is yes and here’s how:

Step 1: Install the .Net 4.0 Framework Beta 2 on your build server (or just put VS2010 beta 2 on it)

Step 2: Change the Team Build config as follows

  • Stop the Team Build service
  • Go to C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies and open up TfsBuildService.exe.config in the text editor of your choice.
  • Find the MSBuildPath setting and set the value as follows
    <add key="MSBuildPath" value="c:\windows\\Framework\v4.0.21006\" />
  • Restart the Team Build service and check that your builds work.
    Step 3: You’re done.  Go and ask your boss for a pay rise for being so efficient.

P.S. If your build breaks with errors like this:

error MSB4019: The imported project "C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

Then it’s likely because you haven’t installed VS2010 installed on your build server.  Go ahead and install it and you should find that the errors are resolved.

So what are you waiting for, go ahead and switch and have fun with VS2010!

…and as always, I take no responsibility if you screw something up – this is beta software after all! :-)


  1. Have you tried to set up a new build definition from VS2010?

    I can't figure out how to generate the TFSBuild.proj-file. In VS2008 Team explorer this was a part of the 'New Build definition' > Project File tab. A wizard helped you through this process.

    Kind Regards

  2. Yes, though a VS2010 build definition is for TFS2010. To create new TFS2008 builds you need VS2008. In 2010 the build uses workflows now instead of msbuild, and you work of a process template that you can then plug into. Probably a subject for a different post :-)

  3. Thanks a lot! Seems like we have to upgrade to TFS2010 as well. We have experienced several problems using VS2010/TFS2008. Seems like this is not a good combination, unfortunately. You still need VS2008 both on dev-machine and TFS-server (to be able to run unit tests), even if we are developing in VS2010.

  4. This worked for us allowing a TFS 2008 build agent compile VS 2010 solution/project files without installing VS 2010:

    1. Install .NET Framework 4.0 and .NET Framework 3.51 SP1 (for some reason, SP1 wasn't included with 4.0?)

    2. Install Windows SDK 7.0A. When I'm writing this the SDK is still not released so we had to:

    From a computer with VS 2010 installed, copy the SDK folder from %programfiles%\Microsoft SDKs\Windows\v7.0A and registry settings from HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\7.0A to the build machine.

    3. Copy %programfiles%\MSBuild\Microsoft\VisualStudio\v10.0 to the build machine

    4. Change ToolsVersion from 3.5 to 4.0 in your TFSbuild.proj file.

    I think that was all. There was no need to change the build agent's configuration file.

  5. This worked for us Richard using the VS2010 Ultimate product after RTM. Obviously the .net framework version for the msbuild tools was different but other than that, your post worked, to the very letter. As an FYI ours is also building Silverlight 4 and so beyond the standard VS2010 install we have the Silverlight tools as well. It all 'just worked'.

  6. If I change the setting on my Team Build service, will my 2008 projects continue to build just as they did before?

  7. This worked for all 2010 C# projects but we have a problem with our VC++ 2010 projects building in TeamBuild 2008 (actually they won't build). We keep getting errors because the 2008 build targets send all VC++ project files to the VCBuild target and they don't need to because the projects were converted and will build with 2010 msbuild just fine.

    Is there any way to override the VCBuild target? Kind of like how we put in the new msbuild path to the 4.0 msbuild?


  8. Hi,

    this is what I have done to work around the issue


  9. i have followed steps above.but i faced the problem that it build solution with tools version 2.0. But it trigger tfsbuild.config with tools version 4.0.Have anyone1 faced this problem before??can share the solution?

  10. This works... Thanks :)

  11. You are a king amongst men! Thank you!

  12. This is fantastic and we used this prior to you upgrading us to tfs2010. Just wondering, have you got a similar article about how To Build VS2012 solutions using TFS2010 Team Build?