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

Queue a Build

173 Views
Copy Code Show/Hide Line Numbers
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.Build.Client;
 
namespace Microsoft.TeamFoundation.Sample
{
    class Program
    {
        static void Main(string[] args)
        {
            // replace this string with the URI to your team project collection
            using (var tfs = TeamFoundationServerFactory.GetServer("[TFS Uri]"))
            {
                // replace these two strings with the team project and build definition
                var teamProject = "[team project]";
                var definitionName = "[build definition]";
 
                var buildServer = (IBuildServer)tfs.GetService(typeof(IBuildServer));
                var buildDefinition = buildServer.GetBuildDefinition(teamProject, definitionName);
                var buildRequest = buildServer.CreateBuildRequest(buildDefinition.Uri);
 
                buildServer.QueueBuild(buildRequest);
            }
        }
    }
}
by Jim Lamb
  October 28, 2009 @ 1:39pm
Tags:
Description:
Queues a new build of the specified build definition in the specified team project

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