We're upgrading our TFS farm to TFS 2012. In doing so, we've set up a new build server using the upgrade path in TFS Setup. However our new build controller has the name TFS2012Build, whereas the old one was TFSBuild.
Now I have many hundreds of build definitions that have an invalid build controller. Is there a way to update the build controller automatically or by script?
JamieMeyer had the right idea. There's not much good TFS documentation in MSDN, but there are a lot of good blogger resources. Here's a slightly obfuscated version of the script I created to do this over the course of a very educational weekend. We updated one project's build controllers by hand and then programmatically updated all of the other projects depending on the name of the build. call it like
BuildControllerChangeUtil http://tfsserver:8080/tfs/defaultcollection ProjectName
where the projectname is a project whose builds have updated build servers.I am unaware of any "automatic" methodology to do this. It is easy enough to get to the build definitions via the API, and the BuildController is available.
in the absence of decent TFS API documentation, there are many that have examples available for use of the API. A simple google search will reveal these.
A few suggestions to help kick start your effort: http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.build.client.ibuilddefinition.aspx
A good sample app is here: http://blogs.microsoft.co.il/blogs/shair/archive/2011/01/11/tfs-api-part-33-get-build-definitions-and-build-details.aspx
Finally, there is good code here that edits build definitions, and may be a better starting point for you: http://geekswithblogs.net/jakob/archive/2009/12/08/tfs-2010-ndash-managing-build-agents-using-the-api.aspx
Good luck.