Writing the Build Report with Associated Changesets and Work Items to a file as part of the build

The Goal

TFS has a nice Build Reporting, including a list of associated changesets and work items (if any). You might want to have this information saved to a file during a build.

Figure 7.6 Build Report

The Solution

When you use the new TfvcTemplate.12.xaml build process template, it’s easy to run addition scripts or tools as part of the build process.

There is a tool available (TfbNotes.exe) that generates a build report in .TXT and .XML format. It is free and can be downloaded here.

All you need is to check-in the file into version control and reference it in the build process, for example at “3. Test” » “2. Advanced” » “Post-test script path”.


Note: To run more than a single tool, use batch files or PowerShell scripts.

Here’s how the .TXT output looks like:


Note: TFS 2013 Update 2 (2013.2) is required. If you are not on Update 2, you can explicitly use the /collection (or just "/c") parameter to specify your TFS Collection URL.



Updated (May 21, 2014): Added a note that TFS 2013 Update 2 is required (+ workaround).

3 thoughts on “Writing the Build Report with Associated Changesets and Work Items to a file as part of the build”

  1. Many thanks for posting this solution! Ive tried to get TfbNotes.exe working but my builds all fail with the following error message:

    Exception Message: TF270015: ‘TfbNotes.exe’ returned an unexpected exit code. Expected ‘0’; actual ‘100’. See the build logs for more details. (type UnexpectedExitCodeException)
    Exception Stack Trace: at System.Activities.Statements.Throw.Execute(CodeActivityContext context)
    at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
    at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

    Any thoughts on this issue?

  2. UPDATE: Chris’ issue is resolved. It turns out that the TF_BUILD_COLLECTIONURI environment variable was introduced in TFS 2013 Update 2 (2013.2).

    So to run this tool, you either need TFS 2013.2 – or alternatively you can specify the TFS Collection URL with the /collection (or just “/c”) parameter.


Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>