如何使用 Visual Studio 加载项打开 TFS 变更集详细信息对话框视图?

编程入门 行业动态 更新时间:2024-10-13 00:36:09
本文介绍了如何使用 Visual Studio 加载项打开 TFS 变更集详细信息对话框视图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我在 TFS 中有一个特定的工件,比如变更集123",它具有 URI vstfs:///VersionControl/Changeset/123".我意识到链接 "Brian Harry:致力于 TFS SDK改进和TFSAddin.zip 示例代码(ZIP 文件还包含有关 API 的文档)

本质上,您需要引用以下程序集:

 Microsoft.TeamFoundation.ClientMicrosoft.TeamFoundation.VersionControl.ClientMicrosoft.TeamFoundation.VersionControl.ControlsMicrosoft.VisualStudio.TeamFoundationMicrosoft.VisualStudio.TeamFoundation.ClientMicrosoft.VisualStudio.TeamFoundation.VersionControl

然后您可以使用 VersionControlExt.ViewChangesetDetails(int changesetId) 来显示来自加载项的特定变更集:

VersionControlExt vce;vce = _applicationObject.GetObject("Microsoft.VisualStudio.TeamFoundation.VersionControl.VersionControlExt") as VersionControlExt;vce.ViewChangesetDetails(changesetId);

这会打开一个对话框,向用户显示有关特定变更集的所有详细信息.(如果用户在查找变更集"对话框中选择详细信息...",则会出现相同的对话框.)

I have a specific artifact in TFS, say changeset "123", which has the URI "vstfs:///VersionControl/Changeset/123". I realized that the link "http://tfs:8080/tfs/web/UI/Pages/Scc/ViewChangeset.aspx?changeset=123" will open the changeset detail view using the web-browser.

What I would like to do is open the changeset detail view inside visual studio. The place where I am embedding this is a custom section inside the build summary. I implemented this custom section as a VisualStudio Plugin. Here is a picture:

The section "Release Build" is custom-made and will provide information about an email that will be send to everyone, once such a build is released.

The Changeset 627 inside this section is a Button control that has automatically been transformed into a link. The "Click"-Handler behind the button works. The code currently looks like this:

...
string link = buildDetailView.TeamProjectCollection.Uri.AbsoluteUri.Substring(0, buildDetailView.TeamProjectCollection.Uri.AbsoluteUri.LastIndexOf('/'));
link += "/web/UI/Pages/Scc/ViewChangeset.aspx?changeset=";
link += ((Button)sender).Content;

Process.Start(new ProcessStartInfo(link));
e.Handled = true;
...

This code will open a new Browser tab and show the correct page. However, I would like it to open the changeset detail inside Visual Studio. Just like the button at the bottom in section "Associated Changesets" does. When you click on the link "Changeset 627", it will open that changeset inside Visual Studio.

EDIT 1

It may be a bit clearer what exactly the desired outcome is, if I post a picture of it. The "Changeset Details" Window is what I would like to open using the API.

解决方案

Take a look at the following blog posts:

Ed Hintz: How to write a Team Foundation Version Control Add-In for Visual Studio Brian Harry: Working on TFS SDK improvements and TFSAddin.zip sample code (ZIP file includes a doc on the API as well)

Essentially, you need references to the following assemblies:

 Microsoft.TeamFoundation.Client
 Microsoft.TeamFoundation.VersionControl.Client
 Microsoft.TeamFoundation.VersionControl.Controls
 Microsoft.VisualStudio.TeamFoundation
 Microsoft.VisualStudio.TeamFoundation.Client
 Microsoft.VisualStudio.TeamFoundation.VersionControl

Then you can use VersionControlExt.ViewChangesetDetails(int changesetId) to display a specific changeset from your add-in:

VersionControlExt vce;
vce = _applicationObject.GetObject("Microsoft.VisualStudio.TeamFoundation.VersionControl.VersionControlExt") as VersionControlExt;
vce.ViewChangesetDetails(changesetId);

This brings up a dialog that shows the user all the details about a particular changeset. (It is the same dialog that appears if the user selects "Details..." in the "Find Changesets" dialog.)

这篇关于如何使用 Visual Studio 加载项打开 TFS 变更集详细信息对话框视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-30 18:49:02,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:详细信息   视图   如何使用   对话框   加载

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!