Thursday, May 17, 2012

How to retrieve all build definitions using Team Build API in TFS 2010


Team Foundation Server 2010 provides us with Team Foundation Server API to manage lots of items via code.  In this example we shall see how we can retrieve Build definitions for a given Team Project in a given Team Project Collection.

First you will have to add references to the following assemblies. Go to Project>Add Reference>Search for Microsoft.TeamFoundation and you will all the three assemblies required for our project.
The IBuildDefinition contains all the properties and methods related to a TF Build Definition. In the above code, we are also displaying ProcessParameters of the IBuildDefinition object. When you see it will show us an XML formatted string and in order to manipulate this string we have to parse the xml and then change those parameters. We can queue multiple builds in a single click if we want to. Moreover, if we want, then we can do some complex logic like triggering another build based upon a build's status. I haven't tried but it seems exciting to me. Leave your thoughts and comments below regarding the article.

Introduction: Hello World

This is my first post on this blog and as from the title of the blog you might have guessed that it is related to coding and sometimes on a broader topic of technology. I have been writing on general topics on Journey Blog and I have learned a lot by blogging. You can find my CV on LinkedIn. An introductory post should contain some code so here it is.
This is a very simple way of printing “Hello” and “World” after two seconds using Node.js. You can check this StackOverflow post for more.

I am a self-taught programmer and I am not an expert in any subject so if you find any mistakes then please help me correct them. I would be glad to hear from you in the comments below. Stay Tuned.