Customize Team Build 2010 – Part 13: Get control over the Build Output

by Ewald Hofman 12. December 2010 22:57

In the series the following parts have been published

  1. Part 1: Introduction
  2. Part 2: Add arguments and variables
  3. Part 3: Use more complex arguments
  4. Part 4: Create your own activity
  5. Part 5: Increase AssemblyVersion
  6. Part 6: Use custom type for an argument
  7. Part 7: How is the custom assembly found
  8. Part 8: Send information to the build log
  9. Part 9: Impersonate activities (run under other credentials)
  10. Part 10: Include Version Number in the Build Number
  11. Part 11: Speed up opening my build process template
  12. Part 12: How to debug my custom activities
  13. Part 13: Get control over the Build Output
  14. Part 14: Execute a PowerShell script
  15. Part 15: Fail a build based on the exit code of a console application

In the part 8, I have explained how you can add informational messages, warnings or errors to the build output. If you want to integrate with other lines of text to the build output, you need to do more. This post will show you how you can add extra steps, additional information and hyperlinks to the build output.

UPDATE 13-12-2010: Thanks to Jason Pricket, it is now also possible to not show every activity in the build log. This is really useful when you are doing for-loops in your template. To see how you can do that, check out Jason's blog:

Add an hyperlink to the end of the build output

Lets start with a simple example of how you can adjust the build output. In this case we are going to add at the end of the build output an hyperlink where a user can click on to for example start the deployment to the test environment.

In part 4 you can find information how you can create a custom activity

To add information to the build output, you need the BuildDetail. This value is a variable in your xaml and is thus easily transferable to you custom activity. Besides the BuildDetail the user has also to specify the text and the url that has to be added to the end of the build output.

The following code segment shows you how you can achieve this.

    public sealed class AddHyperlinkToBuildOutput : CodeActivity
        public InArgument<IBuildDetail> BuildDetail { get; set; }
        public InArgument<string> DisplayText { get; set; }
        public InArgument<string> Url { get; set; }
        protected override void Execute(CodeActivityContext context)
            // Obtain the runtime value of the input arguments           
            IBuildDetail buildDetail = context.GetValue(this.BuildDetail);
            string displayText = context.GetValue(this.DisplayText);
            string url = context.GetValue(this.Url);

            // Add the hyperlink
            buildDetail.Information.AddExternalLink(displayText, new Uri(url));
If you add this activity to somewhere in your build process template (within the scope Run on Agent), you will get the following build output

Add an line of text to the build output

The next challenge is to add this kind of output not only to the end of the build output but at the step that is currently executing. To be able to do this, you need the current node in the build output. The following code shows you how you can achieve this.

First you need to get the current activity tracking, which you can get with the following line of code

            IActivityTracking currentTracking = context.GetExtension<IBuildLoggingExtension>().GetActivityTracking(context);

Then you can create a new node and set its type to Activity Tracking Node (so copy it from the current node) and do nice things with the node.

            IBuildInformationNode childNode = currentTracking.Node.Children.CreateNode();
            childNode.Type = currentTracking.Node.Type;
            childNode.Fields.Add("DisplayText", "This text is displayed.");

You can also add a build step to display progress

            IBuildStep buildStep = childNode.Children.AddBuildStep("Custom Build Step", "This is my custom build step");
            buildStep.FinishTime = DateTime.Now.AddSeconds(10);
            buildStep.Status = BuildStepStatus.Succeeded;
Or you can add an hyperlink to the node
            childNode.Children.AddExternalLink("My link", new Uri(;
When you combine this together you get the following result in the build output


You can download the full solution at It will include the sources of every part and will continue to evolve.



4/7/2011 1:17:41 AM #


Pingback from

Ewald Hofman | Part 15: Fail a build based on the exit code of a console application |

5/31/2011 8:23:00 AM #


Pingback from

MSDN Blogs |

10/23/2013 10:54:21 AM #


Pingback from

c# – TFS 2010: How to create BuildDetail Links that can be displayed in a webbrowser? | Ask TechwikiHow |

3/19/2014 10:55:51 PM #


Pingback from

Obtaining Build Stop in Long-Run Activity | Roy Rosenberg |

Comments are closed

Powered by BlogEngine.NET
Theme by Mads Kristensen


Widget Statistics not found.

There is an error in XML document (0, 0).X

Recent comments

Comment RSS