Building .NET 4.0 Applications Using Team Build 2008


Our division’s primary Team Foundation Server is running TFS 2008 and as such we’re using Team Build 2008. This week I wanted to set up a Team Build 2008 definition to build a .NET 4.0 Silverlight application and this post explains how to do that.



  1. Your build agent must be running Team Build 2008 Service Pack 1. If you do not have Service Pack 1 installed you will receive an error relating to a missing parameter on the GetBuildProperties task once you install Visual Studio 2010 Beta 2 on the build agent. Thanks to Aaron Hallberg for helping me resolve this issue.

  2. Install Visual Studio 2010 Beta 2 on the build agent to make sure that .NET Framework 4.0, the .NET Framework 4.0 SDK, and other dependencies are available.

  3. Configure Team Build 2008 to use MSBuild 4.0 instead of MSBuild 3.5. To do this edit %ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\TFSBuildService.exe.config and set the MSBuildPath property to C:\Windows\Microsoft.NET\Framework\v4.0.21006\.

  4. Restart the Team Foundation Build service.


Please note that this is a build agent-wide setting and ALL build definitions built by that build agent will use MSBuild 4.0. This typically isn’t an issue because MSBuild has good backwards compatibility but you should be aware of this.


That’s all there is to it… So far I’ve only built a single .NET 4.0 Silverlight application but this technique should work for all .NET 4.0 applications.


[Edit] Added step 4 to restart the service.


[Edit] Added missing “v” in framework path.

Comments (6)

  1. AnthonyDiaz says:

    Is there a similar solution for TFS 2005?  We are currently trying to upgrade to VS 2010 and having several build issues.  Would like to avoid installing the full VS 2010 on the build server and only push out the pieces that are needed for the build to function.  We already have the build server working properly with VS 2008 SP1 projects.

  2. I don’t believe TFS 2005 allowed you to redirect the path to MSBuild.exe. What did you do to get VS 2008 SP1 projects working? One solution I’ve heard of (but it’s not trivial and not supported) is renaming MSBuild.exe to MSBuildOriginal.exe and creating your own MSBuild.exe in its place that inspects the project file being built and then shells out to the correct MSBuild.exe passing through the same arguments it is passed.

  3. Jurjen74 says:

    Ofcourse now that the final version is out… the path is c:WindowsMicrosoft.NETFrameworkv4.0.30319

  4. Jurjen74 says:

    Of course now that the final version is out… the path is c:WindowsMicrosoft.NETFrameworkv4.0.30319

  5. kvillines says:

    This worked for all 2010 C# projects but we have a problem with our VC++ 2010 projects building in Team Build 2008 (actually they won't build).

    We keep getting errors because the 2008 build targets send all VC++ project files to the VCBuild target. The projects have been converted to 2010 so the VCBuild target isn't needed.  Team Build 2008 should be building the VC++ 2010 projects using MsBuild.

    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?

    Ideas?

  6. cheong says:

    i had done 4 steps above.i even change the tools version in tfsbuild.config to 4.0.but when it build solution, it build with tool version 2.0 but it others steps it look fine.Anyone face this problem before?Can anyone share the solution?I using vs2010 ultimate and team build 2008.

Skip to main content