TFS 2012: Add a custom section in a build summary 2

TFS 2012: Add a custom section in a build summary

With the previous versions of TFS you could customized the buil summary from TeamBuild by developing Visual Studio add-in and deploy is on every computer. This was not simple and it was simplified in Visual Studio 2012 / Team Foundation Server 2012 :)

Everything is done with the new standard TeamBuild activity WriteCustomSummaryInformation:

  1. Open your build workflow.
  2. Add the WriteCustomSummaryInformation activity where you want.
  3. Sets the activity parameters.

The available parameters are the following :

  • SectionKey : the section unique key,
  • SectionDisplayName : the section name to display on the summary,
  • SectionPriority : the section priority which defines it’s placement relative to other sections,
  • Message : the message to display.

And here is the custom section you get:

image

If you want to display multiple lines from different locations in your workflow, you can add as many activity as need just remember to specify the same SectionKey. For the SectionDisplayName and SectionPriority parameters it’s the first encountered value that is used.

Messages must be text only but can contains links. To add links in your messages, use the following syntax : (link). If the link starts with “vsts:”, it will be considered as a link pointing to a TFS artefact and will be handle by Visual Studio; for other link types, the operating system is called :)

The priority must be an integer greater or equals to 0, 0 is the highest priority which will place the section at the top of the summary. The first standard section starts at 100. You can hover with the mouse on a section name to display its key and priority (as shown in the previous screenshot :)). By using these, you can add your own messages to the standard sections. you can even reorder them and change their name by specifying new values to the SectionDisplayName and SectionPriority parameters :)

As explained, messages can only be text based, this is a limitation of the new activity and model. If you need to add a custom section with more rich content (text, images, graphics…) you will have to use the same method as in the previous version and develop a Visual Studio add-in.

Even if it doesn’t cover every need, this standard activity is a good start :)

Carpe Diem.

2 thoughts on “TFS 2012: Add a custom section in a build summary

  1. Reply Denniz Jun 23,2015 16:14

    In a custom CodeActivity, i added code:


    var summaryReport = new WriteCustomSummaryInformation()
    {
    SectionKey = "BazingaSection",
    SectionDisplayName = "Bazinga Tests",
    SectionPriority = 175,
    Message = "This is my bazinga test"
    };
    context.Track(summaryReport);

    But it is does not turn up in the summary, any idea what i’m doing wrong?

  2. Reply Denniz Jun 23,2015 16:33

    Just found out what is working in a custom CodeActivity. Need to use the CustomSummaryInformation object.

    var sumReport = new CustomSummaryInformation()
    {
    SectionPriority = 175,
    Message = "My Bazinga message",
    SectionHeader = "Bazinga SectionHeader",
    SectionName = "BazingaSection"
    };
    context.Track(sumReport);

Leave a Reply

  

  

  

CAPTCHA *