How can I open the TFS changeset details dialog view using a Visual Studio add-in?

前端 未结 2 1820
你的背包
你的背包 2020-12-29 12:22

I have a specific artifact in TFS, say changeset \"123\", which has the URI \"vstfs:///VersionControl/Changeset/123\". I realized that the link \"ht

相关标签:
2条回答
  • 2020-12-29 12:46

    In VS 2015 you can use the following code taken from here

    public void ViewChangesetDetails(int changesetId)
    {
            ITeamExplorer teamExplorer = this.GetService<ITeamExplorer>();
            if (teamExplorer != null)
            {
                teamExplorer.NavigateToPage(new Guid(TeamExplorerPageIds.ChangesetDetails), changesetId);
            }
    }
    
    0 讨论(0)
  • 2020-12-29 13:11

    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.)

    0 讨论(0)
提交回复
热议问题