CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Language: C#

Query for Build Controllers and Agents

199 Views
Copy Code Show/Hide Line Numbers
using Microsoft.TeamFoundation.Build.Client;
 
// enumerate the build controllers and agents for the specified project collection
var tfs = TeamFoundationServerFactory.GetServer("http://tfserver:8080/tfs/DefaultCollection");
IBuildServer buildServer = (IBuildServer)tfs.GetService(typeof(IBuildServer));
 
var buildControllers = (IEnumerable<IBuildController>)buildServer.QueryBuildControllers(true);
 
foreach (IBuildController controller in buildControllers)
{
    Debug.WriteLine("{0} ({1})", controller.Name, controller.ServiceHost.Name);
 
    foreach (IBuildAgent agent in controller.Agents)
    {
        Debug.WriteLine("\t{0} ({1})", agent.Name, agent.ServiceHost.Name);
    }
}
by Jim Lamb
  October 29, 2009 @ 7:49pm
Tags:

Add a comment


Report Abuse
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate