TFS & Visual Studio ALM – by Neno Loje

(formerly Team System, VSTS)

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

May 19th, 2014 · 9 Comments · Team Foundation Build (TF Build), Tools and Utilities

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”.

TfbNotes_Process

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

Here’s how the .TXT output looks like:

TfsNotes.exe

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.

Enjoy!

–Neno

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

Tags:

9 Comments so far ↓

  • Chris

    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?

    • vstsblog

      @Chris: Thanks for reporting. Can you run the tool with /showerror and send me the command lineoutput as well as the log file that got created (%TEMP%\ExceptionInfo_TfbNotes.exe.txt)?
      –Neno

  • neno

    Chris,

    Please send the console output of the tool! You can find it on the Logs folder on the drop location, or you can access the full diagnostic logs when using Team Web Access as you can see here:
    http://blog.nwcadence.com/whats-new-in-visual-studio-2013-team-build-powershell/

    Also, feel free to use the “Contact” feature of this blog, so I can actually reach you! :)

    –Neno

  • neno

    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.

    –Neno

  • Praveen

    Is there a possibility that you can share the code ..I need to tweek the output formatting …

    • Neno

      @Praveen,
      What kind of formattings are you looking for?
      You could use the generated XML file and transform it into the format of your choice.
      Sorry, the tools are released “as is”. The code is not available or open-sourced.
      –Neno

  • MiKi Pina

    Is there any way I can get this to work with TFS 2012?

    If not, do you have any suggestions or examples on how would I achieve the same output with TFS 2012?

    • Neno

      @Miki,
      I stopped testing against TFS 2012, but if you install the TFS 2013 Object Model on your build server you might be able to run the TFS 2013-version of the tool. Would you like to try that and let me know?
      –Neno

  • Gregory Baytler

    Please provide TFS 2013-version of the tool. I would like to try it. Thank you.

Leave a Comment

*