Click here to Skip to main content
15,867,453 members
Articles / .NET / .NET4

How to Configure TFS Server to Build Solutions v.2008 and v.2010 Side by Side on the Same Machine

Rate me:
Please Sign up or sign in to vote.
5.00/5 (10 votes)
9 Jan 2010CPOL4 min read 69.6K   18   6
This article shows how to build different versions of Visual Studio solutions on the same build server.

Problem Statement

Business Intelligence (BI) project types will not be supported by the new version of Visual Studio 2010 (at least for some time after release). See this MSDN forum post for more information. Developers are supposed to use Visual Studio 2008 to work with these projects. It means that if you have Reporting or SSIS projects, you still need the former version of Visual Studio to build them on a build server.

Apparently, Visual Studio 2010 and 2008 will coexist in team development environment and as a consequence, continuous integration process must support both versions.

The problem is that there is no straightforward way to build solutions of different versions side by side on the same TFS build server. After you install .NET 4.0 and Visual Studio 2010 on your build server, it will be able to build only the solutions converted to this version. Attempt to build BI projects will fail.

Note: One has to distinguish between this problem and multi-targeting. Multi-targeting is all about compiling one source code for different versions of .NET Framework. Some people mistakenly mix it with compiling solutions of different versions.

Concept

The heart of TFS build server is a Windows Service called "Visual Studio Team Foundation Build". This service is responsible for launching MSBuild script. It can be configured for using particular version of MSBuild.

MSBuild from .NET 4.0 is able to compile solutions v.2010. But it does not recognize Business Intelligence projects that are supported by Visual Studio 2008. To build these projects, one needs to use MSBuild 3.5.

Unfortunately, Visual Studio Team Foundation Build service uses only one version of MSBuild. It cannot intelligently "switch" between versions depending on our needs.

However, we can employ the ability to run it in console mode. Thereby, we can have multiple instances of build service on the same machine. Every instance will use individual configuration:

  • The first instance will be run as a Windows Service and listen port 9191. It will compile solutions v.2010 using MSBuild v4.0.
  • The second instance will be run as a Console Application and listen port 9194. It will compile v.2008 using MSBuild v3.5.

In Visual Studio Team Explorer, these instances will be visible as a two different Build Agents. Then we can assign particular Build Agent to corresponding build definition.

Image 1

Step by Step Instructions

  1. Go to folder: C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\Private Assemblies
  2. Find files TFSBuildService.exe and TFSBuildService.exe.config
  3. Create copies of these files in the same folder: TFSBuildService2.exe and TFSBuildService2.exe.config
  4. Open TFSBuildService.exe.config file.

    Change element:

    XML
    <add key="MSBuildPath" value="">

    to:

    XML
    <add key="MSBuildPath" value="c:\windows\microsoft.net\framework\v4.0.21006\"> 
  5. Open TFSBuildService2.exe.config file.

    Change element:

    XML
    <add key="MSBuildPath" value=""> 

    to:

    XML
    <add key="MSBuildPath" value="c:\windows\microsoft.net\framework\v3.5\">

    Change element:

    XML
    <add key="InteractivePort" value="9192">

    to:

    XML
    <add key="InteractivePort" value="9194">
  6. Now restart "Visual Studio Team Foundation Build" Windows service on build machine (go to Control Panel/Administration Tools/Services).
  7. Create shortcut for TFSBuildService2.exe. I would recommend to add this shortcut to Startup.
  8. Run TFSBuildService2.exe. You will see a console window opened. Do not close it. While it is open, your build server is being able to build solutions v2008.
  9. Open Visual Studio 2008, Team Explorer, right click on Builds folder in your project, select Manage Builds Agents. "Manage Build Agents" window will be opened. (Note: You should use namely VS 2008 because I did not find corresponding menu item in VS 2010 Beta 2. They will definitely fix it in release.)
  10. Now we have to create two build agents:
    • "Agent 2008" with following parameters:
      Computer name: <name of build machine>
      Communications port: 9194
      Working directory: <path on build machine where sources for 2008 will be located>

    • "Agent 2010" with following parameters:
      Computer name: <name of build machine>
      Communications port: 9191
      Working directory: <path on build machine where sources for 2010 will be located>

      Note: Working directories for 2008 and 2010 must be different!

  11. In Team Explorer, select a build that has a solution of version 2008, right click and select Edit Build Definition and then go to Build Defaults and select Agent 2008. Close the window.

  12. In Team Explorer, select a build that has a solution of version 2010, right click and select Edit Build Definition and then go to Build Defaults and select Agent 2010. Close the window.

Version Notice

This article is written when Visual Studio 2010 Beta 2 was released. Information in the article can probably be subject to change when the final version will be released.

History

  • 10.01.2010 - Article published

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
Australia Australia
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
QuestionHaving Issues Pin
AVINASH NOWDURU8-Mar-11 19:34
AVINASH NOWDURU8-Mar-11 19:34 
GeneralNot working for me Pin
Lena Vino8-Feb-10 9:26
Lena Vino8-Feb-10 9:26 
GeneralRe: Not working for me Pin
Sergey Arhipenko8-Feb-10 23:08
Sergey Arhipenko8-Feb-10 23:08 
QuestionДружище ты куда пропал? Pin
Alexander Nesterenko11-Jan-10 2:01
Alexander Nesterenko11-Jan-10 2:01 
AnswerRe: Дружище ты куда пропал? Pin
Bashir Magomedov21-Jan-10 7:20
Bashir Magomedov21-Jan-10 7:20 
GeneralRe: Дружище ты куда пропал? Pin
Sergey Arhipenko22-Jan-10 1:09
Sergey Arhipenko22-Jan-10 1:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.