TFS 2008 – Running two Build Agents on the Same Machine


There have been at least a couple of forum posts from users that would like to run more than one build agent on the same physical machine. The normal reason is that they have more than one TFS server and want to use the machine as a build agent for both.


In this post I will describe how to add another build agent to a machine that already has one installed. The steps are very manual but should be simple enough.



  1. First you need to copy the actual binary for the service and it’s config file. The config file is keyed off the name of the binary, and we have to have a separate config file for each.


    • cd “C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies”

    • copy TfsBuildService.exe TfsBuildService-2.exe

    • copy TfsBuildService.exe.config TFSBuildService-2.exe.config

  2. Next you need to edit the new config file to point to the other server and use a different port number.


    • notepad TFSBuildService-2.exe.config

    • Search for port and change the port number from 9191 to something new like 8181

    • There’s also another port number for interactive running that defaults to 9192, you should change that one as well. Let’s say to 8182.

    • Now, search for AllowedTeamServer and set the value to the full URL of the new server.

    • Save your changes.

  3. Now, you can install the new service using sc.exe and get it started.Take note of the spaces after the equals signs in the sc command line.


    • sc \\jpricket-test create “MyVSTFBuild” binPath= “C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\TfsBuildService-2.exe” DisplayName= “My Team Build Service”

    • Now, open up Control Panel\Administrative Tools\Services.

    • Find “My Team Build Service”. Right click on it and open Properties.

    • On the Log On tab, set it to the service account and password that you want to use.

    • Hit OK to save your changes and then start the service. 

  4. Finally, you have to create a build agent on the other server that points to this new machine and port.


    • Open Visual Studio

    • Connect the other TFS server and the correct Team Project

    • Right click on the Builds node in team explorer and select Manage Build Agents.

    • Make sure to create one with the correct port number and machine name.

    • You will also want to change the “Working Directory” to something different that the other instance of the build service uses. I used “$(Temp)\my\$(BuildDefinitionPath)”

  5.  Now, you’re ready to build on both agents using the same machine.

UPDATE: I neglected to mention that you should reserve the new port number that you decide to use in step 2. You can read up on how to do this with the wcfHttpConfig tool here. Basically you just need to run a command prompt, change to the privateassemblies area of the Visual Studio program directory (usually C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies) and type the following at the command line:  wcfhttpconfig.exe reserve DOMAIN\TeamBuildAccount 8181


 

Comments (10)

  1. Bonjour à toutes et à tous Dans ce poste de Jason Prickett, vous pourrez découvrir comment simplement

  2. buckh says:

    For folks that do this, deep in mind that by doing this you accept an additional servicing burden.  If we ship any patches to tfsbuildservice.exe or when we release Service Pack 1 for TFS 2008, you will need to handle updating the copy (or copies) of tfsbuildservice.exe and tfsbuildservice.exe.config that you create and restarting the associated Windows services.

    For many folks, this is a valuable solution, but I wanted to make sure folks are aware of the servicing implications.

    Buck

  3. Buck Hodges on TFS 2008: Command line help for tf.exe now prints to the console. Jason Prickett on TFS…

  4. todd.liu says:

    about below command , I have some question need your kindly help , thanks

    wcfhttpconfig.exe reserve DOMAINTeamBuildAccount 8181

    1.what’s the command function for?

    2.why I should reserve the port?

    3. abpit DOMAINTeamBuildAccount , what’s the account for , what’s user account I can use?

    Thanks very much

  5. Jason Prickett says:

    All the information for why and how to use wcfhttpconfig should be in the link that I provided. But basically, you are setting permission’s so that the TfsBuildService account can use that port. This is important to keep your machine secure.

  6. styerr says:

    This might be slightly off topic but I’m getting pretty desparate here. I’ve been totally dead in the water for several weeks now and I can not seem to find any information on this.  We have TEAM Foundation Server 2008 and we had TEAM Foundation Build working to do Builds.  We are trying to configure all of TEAM Foundation Server for HTTPS and Secure Sockets.   I have followed all the steps in the MSDN Walktrough: Setting up Team Foundation Server to Require HTTPS and Secure Sockets  (2008 version).  After working through the section "To install the certificate on build computers" through "To verify the SSL configuration", I attempt to start a build and the build fails immediately with the following error:

    TF215085: An error occured while connecting to agent SS_TENA TestVICO-VM TENA: TF215076: Team Foundation Build on computer VICO (port 9191) is not responding. (Detail Message: The underlying connection was closed: An unexpected error occurred on a send).

    I have tried many things but nothing has gotten me any closer.  Can anyone shed some light on where I need to look?  

    I have a lot of questions in the steps to configure SSL on the build computer.  It tells us to use HTTPCFG to configure the SSL port with the thumbprint of a "client authentication" certificate.  Where do we get the client authentication certificate?  Is it specific to a particular user id? If so, should it be the user starting the build, the TFSBuild Service account, that runs the service, an account known to the TEAM Foundation server????  

    Where does this certicate and/or private key for the certificate have to reside (Personnal store?, something accesible on the local computer?)  

    What port should we be using for SSL?  the steps only show 9191 as an example but I believe this was the same port used without SSL.  Can we reuse it?  

    If this isn’t the appropriate place for this discussion, can you direct me to another location that I might get some help.

    Thanks in advance.

  7. Jason Prickett says:

    I can’t answer your question myself, but I know some people who can :)

    Can you paste this question into the following forum? I will make sure the right person gets the question.

    Team Build Forum: http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=481&SiteID=1

    You should get a response in the next day or so :)

  8. In the previous build post TFS Build "Workspace already mapped" Issue we covered a common build

  9. こんにちは! フォーラム オペレーターの服部清次です。 しばらくこちらのブログに投稿しない間に、 2008 年も残すところ、あと 2 週間ほどとなってしまいました。 最近、世の中は暗いニュースが多いですが、新しい気持ちで

  10. MSDNArchive says:

    Is there a way to find open port and also see activity on ports?