If you have used Visual Studio 2017 to connect to a Team Services instance, or you follow the Microsoft ALM blog you will have noticed that with Visual Studio 2017: Work items now open in the web from Visual Studio ’15’!
While the official post shows why that change was made and what advantages the web form brings, I wanted to quickly point out some small things that were done to make this behavior more usable.
You can follow along by downloading Visual Studio 2017 and connecting to your Team Services or Team Foundation Server 2017 instance.
Running Queries from Visual Studio
There is still the full work item query tree available in Visual Studio, including favorites:
You can also still create and run new or existing queries and look at the results:
If you look at the screenshot above, you can see that I have run the “My Bugs” query and that I have selected the second work item from the result, with id 62. When I open this work item now, it will launch in my browser and display the now familiar modern work item form:
And if you look closely, you can see that in the upper right hand corner of the work item form it displays “2 of 4” and some buttons:
When you open a work item from a query result in Visual Studio, we don’t want you lose the query context you were in. So, when opening the work item we pass some context information along, in this case this included the name of the query that you ran and the position of the work item inside of that query result. Then, in the web we can restore this context, show you the work item, and also give you the option to easily switch to the next/previous work item in the “My Bugs” query:
You can also just return to the full query result in the web:
Preserving the context this way works with all queries in Visual Studio, even new and unsaved ones.
<figcaption id="caption-attachment-818" class="wp-caption-text">New, unsaved query in Visual Studio</figcaption></figure>
Linking Work Items to Code Changes
With the Development section on the new work item form we have made it really easy to view code changes that contributed to work item, be it he implementation of a feature or a bugfix:
To associate your code changes with your work items you can create a link after the fact from the work item form, or in Visual Studio when you commit or check in your code. For both Git and TFVC you can still run work item queries from the Changes or Pending Changes view and even drag and drop work items from the query result to the Related Work Items section. Adding a work item to a git commit:
<figcaption id="caption-attachment-792" class="wp-caption-text">Adding a related work item to a git commit</figcaption></figure>