Is it possible to use the TFS SDK to create, queue and track builds?
Richard pointed me in the right direction, so I'm going to answer my own question with what I've found.
Yes, you can use the TFS SDK to create, queue, and track builds. The interfaces/classes you want are located in the Microsoft.TeamFoundation.Build.Client namespace. IBuildServer, IBuildDefinition, and IBuildDetail are particularly useful.
TFS 2010 UPDATE: Here is an example program using the TFS 2010 SDK, found here:
using System;
using System.Collections.Generic;
using Microsoft.TeamFoundation.Build.Client;
using Microsoft.TeamFoundation.Build.Workflow;
using Microsoft.TeamFoundation.Client;
namespace ManageBuildTemplates
{
class Program
{
static void Main(string[] args)
{
TfsTeamProjectCollection collection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri("http://jpricket-test:8080/tfs/collection0"));
IBuildServer buildServer = collection.GetService<IBuildServer>();
IBuildDefinition definition = buildServer.GetBuildDefinition("UnitTests", "Definition1");
IBuildRequest request = definition.CreateBuildRequest();
request.ProcessParameters = UpdateVerbosity(request.ProcessParameters, BuildVerbosity.Diagnostic);
buildServer.QueueBuild(request);
}
private static string UpdateVerbosity(string processParameters, BuildVerbosity buildVerbosity)
{
IDictionary<String, Object> paramValues = WorkflowHelpers.DeserializeProcessParameters(processParameters);
paramValues[ProcessParameterMetadata.StandardParameterNames.Verbosity] = buildVerbosity;
return WorkflowHelpers.SerializeProcessParameters(paramValues);
}
}
}
Look at tfsbuild.exe (in the .../Common9/IDE folder of the VS install).
This references assemblies Microsoft.TeamFoundation.Build.Client
and Microsoft.TeamFoundation.Build.Common
which look helpful, ... and contain namespaces which are not documented with the other TFS cient assembliies, but are on MSDN here http://msdn.microsoft.com/en-us/library/cc339575.aspx