Generate Release Notes by Querying TFS 2012 for Work Items

Posted by & filed under Development, TFS, Uncategorized, Visual Studio.

Full code for this post can be found here:

https://github.com/chrispont/boardwalk.releasenotegenerator

I’ve used a few ALMs, Build Managers, Source Code Repositories over the years and I’d dipped into TFS now and again, but recently I really got to see what TFS 2012 can really do. I remember back when TFS 2005 came out and watching a sysadmin quite literally pull their hair out over how frustratingly complex it was to install and configure, but now it’s an absolute breeze. If you really don’t want to take the plunge and install somewhere on site, you can try out Microsoft’s cloud based offering in the form of  Team Foundation Service which is currently free for up to 5 users.

TFS 2012 Express

TFS 2012 Express is Microsoft’s free version of Team Foundation Server. Like the other Express flavours of developments software, it’s a great way to get a small team up and running on some very feature rich software before spending some cash on some CALs. As mentioned above, setup is little more than clicking next on a wizard a few times, made simpler by the fact that this is the Express edition and so there are a few limitations that mean configuration is compact:

  • No SharePoint or Reporting Services Integration
  • SQL Server Express Only (installed as part of the setup if not already available)
  • Can only be installed on a single server (Db, App and Client Tiers cannot be split across servers)

Because Reporting Services Integration is not available, that means I can’t generate reports on work items that have been completed. I can however still use the TFS API to query work items and generate a nice looking release note using PdfSharp.

pdf example

Creating the Shared Query in TFS

First we need to create a shared query in TFS to filter our work items. Log into the web portal, go to “Work” and create a new shared query there.

TFSQuery

 

The Code

First we need an object store store the WorkItems in.

Next, let’s write a class that will query TFS for the workitems based on the request object passed in. We need to set where the TFS server is, where the query can be found (Shared Queries) and the name of the query. We also specify the Iteration number to make sure we only get workitems associated with this Iteration.

We should have a list of workitems available (assuming your TFS user has permission to use the shared query). What you then do with the work items is up to you. The example code feeds the list of workitems into another service that generates a pdf file using the template pdf files specified in the request. It also uses the Build Number and Iteration Number for the title page and footers. You could also use these classes to add a CodeActivity and make it part of the TFS build, feeding in the Build Number and Iteration number directly from the build itself.

Full code for this post can be found here:

https://github.com/chrispont/boardwalk.releasenotegenerator

and includes the pdf generation classes and a WPF app to test.

WPF App

About Chris Pont


Chris is a UK based Web Developer / Technical Architect with Microsoft Certified Technology Specialist (MCTS) and Microsoft Certified Professional Developer (MCPD) status and 8 years experience with large web applications using .NET, SQL Server and WCF.

Leave a Reply