Reference TFS work item from code comment

2019-04-19 08:27发布

问题:

In Visual Studio (2012+) I want a clickable reference from a code comment to a TFS work item. Is there a simple way to do this, and is this also possible from comments within the body of a function (not being the summary of the function)?

So I want something like this:

/// <summary>
/// Example of a summary
/// </summary>
static void Main()
{
    int dummy = 1; //Should be 1 according to @Task1234 <- should be a hyperlink
}

And rather not something like this:

/// <summary>
/// Example of a summary, see <a href="http://mytfsserver:8080//tfs/myCollection/Branch/_workItems#id=1234"> Task 1234 </a>.
/// </summary>
static void Main()
{
}

Some tag reading material: Recommended Tags for Documentation Comments (C# Programming Guide)

回答1:

No, that isn't possible - not without writing an addin that pre-parses the page looking for likely links.

I know there was an addin like this for FogBugz (and other bug/workitem tracking systems), but I've not seen one specifically for TFS (although that doesn't mean one doesn't exist).