Wednesday 13 May 2009

Reconfiguring Build agents after moving TFS machine.

In my previous post, I wrote about moving Team Foundation server from one machine to another (I moved it from a physical machine to a virtual machine). The move went very smooth and is well documented.

However, making the build agents to work with new TFS was a different story. As part of sanity test after the move, I checked out a few files, checked them back in, browsed through the history, added and updated some work items and everything went hunky dory. But when I tried to run the build, I got the following error:

TF215085: An error occured while connecting to agent \TeamProjectName\AgentName: The build (vstfs:////Build/Build/14918) has already completed and cannot be started again.

Searching the error number on the internet mostly suggested that the user for the build service does not have access rights to access TFS server. It proved to be red herring.

After confirming that the user had all the rights it needed on the build server, the second thing was to verify whether the TFS machine can reach the build server. There is a setting in the tfsbuildservice.exe.config, which tells what servers are allowed to access this build server.


It is empty by default and so was the case with me. The build service keeps the name of the TFS Server at registry entry

HKCU\Software\Microsoft\VisualStudio\9.0\TeamFoundation\Build\Service\AllowedTeamServer

I looked in there and could see that it had the name of my previous TFS service. I changed that. Search the whole registry and replaced all entries of previous TFS server with the new one. Restarted the buld server but it still didn't work.

Then, I put the value of new TFS server in the config file and restarted the service and Wholla it built correctly. Once the build happened, I configured the config file back to it's default state, restarted the service and it still builds correctly.

No comments: