我正在开发Visual Studio扩展,我需要创建一个链接来在Visual Studio中打开给定的Build Summary对话框(图片如下):
我一直在四处寻找,我能找到的最好的解释是打开TFS变更集细节对话框。
谢谢!
答案 0 :(得分:0)
我设法理清了如何做到这一点。
要使用build.Uri属性打开Build Summary,您必须导入:
using Microsoft.TeamFoundation;
using Microsoft.TeamFoundation.Common;
using Microsoft.TeamFoundation.Build.Client;
using Microsoft.VisualStudio.TeamFoundation.Build;
打开构建摘要的示例代码是:
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);
}
希望这可以帮助那些可能需要打开构建摘要的人。