0
votes

I'm developing a Visual Studio Extension and i need to create a link to open a given Build Summary Dialog within Visual Studio (image below):

Visual Studio Build Summary

I've been looking around and the best that i could found is the explanation to open TFS Changeset Details Dialog.

Thank you!

1

1 Answers

0
votes

I've managed to sort out how to do this.

In order to open the Build Summary with the build.Uri Property, you must import:

using Microsoft.TeamFoundation;
using Microsoft.TeamFoundation.Common;
using Microsoft.TeamFoundation.Build.Client;
using Microsoft.VisualStudio.TeamFoundation.Build;

The Sample code to open the Build Summary is:

public void OpenBuildSummary(string tfsServer, string tfsProjectName)
{
      // TFS Connection
      TfsTeamProjectCollection tfsServer = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(tfsServer));
      IBuildServer buildServer = (IBuildServer)tfsServer.GetService(typeof(IBuildServer));

      // Getting the TeamFoundationBuild from DTE Services
      var dteService = Package.GetGlobalService(typeof(EnvDTE.DTE)) as EnvDTE.DTE;
      var tfBuild = (dteService.GetObject("Microsoft.VisualStudio.TeamFoundation.Build.VsTeamFoundationBuild") as VsTeamFoundationBuild);

      var vcs = tfsServer.GetService<VersionControlServer>();
      var teamProjects = vcs.GetTeamProjects(tfsProjectName);
      var builds = buildServer.QueryBuilds(tfsProjectName).Builds;

      // Open First Build Summary from the Query (for Testing Purposes)
      tfBuild.OpenBuild(builds[0].Uri);
}

Hope this helps who may need to open Build Summary's.