TFS SDK 2010 – Part 3 - Enumerate the build controllers and agents

by Ewald Hofman 5. December 2009 21:48

In Part 1 I have described how to access the Application Instance of the TFS server. This post describes how you can create access to your build controller and agents:

In order to get access to the work items, add a reference to:

  • Microsoft.TeamFoundation.WorkItemTracking.Build.dll

You can find the dll’s in C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ReferenceAssemblies\v2.0

Then you have to add the following using statements:

using Microsoft.TeamFoundation.Build.Client;

You can now enumerate the values of a work item with the following code:

// Get the build server
IBuildServer buildServer = tfai.GetTeamFoundationServer(tpc.Id).GetService<IBuildServer>();

// Enumerate the controllers
foreach (IBuildController controller in buildServer.QueryBuildControllers(true))
{
    Console.WriteLine("{0}", controller.Name);

    // Enumerate the agents in the controller
    foreach (IBuildAgent agent in controller.Agents)
    {
        Console.WriteLine("\t{0}", agent.Name);
    }
}

All code examples are based on Beta 2 and are subject to change.

Tags:

VSTS 2010 | TFS SDK

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading



Powered by BlogEngine.NET 1.5.0.7
Theme by Mads Kristensen

About the author

 

Ewald Hofman is MVP VS ALM and consultant at Avanade. His specialization is Application Lifecycle Management solutions based on Visual Studio ALM.

 

 

ClusterMap

Statistics

Statistics created at 09 Sep 2009

72 posts
43 comments
27 raters
24810 visit (135 per day)
8 users online