Thursday, January 12, 2012

TFS automation using LinqPad

On LinqPad

I love LinqPad. I do a lot of stuff with it like files renaming and crawling web pages to download stuff. Basically, I use it as my scripting platform. Some people uses Powershell or other bash languages and tools, I use LinqPad.

TFS automation

We’ve got TFS at work and sometimes I need to do spot checks on multiple projects, I could use the UIs and power tools built-in Visual Studio or the Team Web Access web site but it’s tedious and error prone. I prefer an automated way especially if I need the same information on a regular basis. So I’ve started to look at automating TFS using LinqPad queries. I hope to write a series of posts on this subject, one bit of API at the time and show the power queries I’ve been writing up that help me with my recurring tasks as the TFS guys.

The Basic

The basic stuff you need to know is that if you install Team Explorer alone or as part of Visual Studio you will now have access to the TFS automation API assembly directly from the GAC. They all starts with Microsoft.TeamFoundation name prefix. So adding those to your references you could write queries in LinqPad or write a tool in Visual Studio to automate some of your tasks too.

In the Series

- Setup your first TFS LinqPad query
- TFS Queries: Searching in all files of the source control
- TFS Queries: Recent builds of all team projects
- TFS Queries: Build agents status and build queue
- TFS Queries: Generating a changelog from the branch history
- TFS Queries: Listing all the branches
- TFS Queries: Searching in all work items