0

I am looking to see if it is possible to link a TFS Changeset with a hyperlink directly.

I can create a workitem and in the workitem create a Hyperlink link type to a site and then associate the changeset to the workitem. Doing this however the user has to open the 'Related Work Items' list, open the Related work item, locate the hyperlink link, and open the link.

The end result I am looking for would be when viewing the Changeset Details of a Changeset there would be a 'Related Links' section or something similar where the user could easily see any related hyperlinks for the changeset.

Thanks, Chris

Chris Fox
  • 1
  • 1

1 Answers1

0

So after some trial and lots of errors I have come up with a workable solution for my case. Accomplished by way essentially two actions in a Visual Studio Extension and a new custom Work Item type.

New Work Item type - basically used the Code Review template a hidden work item that can only be created through automation. Removed the fields not needed for my case.

Visual Studio Extension Part 1 - setup up an action that takes place when the user clicks the 'Checkin' button on the Pending Changes window. When this action is triggered the extension will capture some relevant data from the checkin. The extension will then create the new work item and establish two links in the work item. One link is relating the changeset and the work item. The other is a hyplerlink to the desired site.

Visual Studio Extension Part 2 - setup an action for the Changeset Details View. When the Changeset Details View is loading grab the selected changeset ID. This proved to be a somewhat difficult task as a lot of the provided Changeset details classes are private. After grabbing the changeset ID, find the related work items to the changeset. Loop through the links in the work item grabbing the hyperlink links in the work item. Then go through the found hyplerlinks and display them in a new section through WPF in the changeset details view.

Section of code that helped get the changeset ID in the Visual Studio Extension:

var dte = Package.GetGlobalService(typeof(EnvDTE.DTE)) as EnvDTE.DTE;
var dte2 = (EnvDTE80.DTE2)dte;
var vce = dte2.DTE.GetObject("Microsoft.VisualStudio.TeamFoundation.VersionControl.VersionControlExt") as VersionControlExt;
VersionControlHistoryChangesetItem[] versionControlHistoryChangesetItems = vce.History.ActiveWindow.SelectedChangesets;
Chris Fox
  • 1
  • 1