Associate work item or code review to a changeset after check in
Open the Work Item, select "All Links", select the "Link To" button, then "Changeset".
You can then either enter the changeset number, or use "..." to browse.
To manually associate a changeset to a code review so that the code review shows up as a related work item in that changeset's details requires you to modify the work item form for the Code Review Request work item type. This requires the use of the TFS Process Template Editor.
TFS Versions supported
- TFS 2015 | TFS 2013 | TFS 2012
The steps below should be supported on these on premise deployments. - Azure DevOps Services (Hosted XML) | TFS 2018 | TFS 2017
The work item form was redesigned in TFS 2017 and some of the XML used below was deprecated. If anyone can provide an equivalent definition for these newer versions I can update this answer.
Install Process Template Editor
Download and install the appropriate version of the Process Template Editor based on the version of Visual Studio that you have:
- VS 2015: Microsoft Visual Studio Team Foundation Server 2015 Power Tools
- VS 2017: TFS Process Template Editor
- VS 2019: Process Template Editor
Modify the Code Review Request work item definition
Once the Process Template Editor is installed, follow these steps to update the Code Review Request work item form.
- Open the Code Review Request work item type definition from the server.
- Open Visual Studio and go to Tools > Process Editor > Work Items > Open WIT From Server.
- In the Connect to Team Project Collection dialog, select the appropriate collection and click Connect.
- Expand your team project, select Code Review Request and click OK.
- Add a new control for changeset links.
- In the Work Item Type window, click the Layout tab.
- Navigate to Layout > TabGroup > Tab Page - Links.
- Right-click Tab Page - Links and select New Control.
- Set the following properties:
- Type: LinksControl
- Label: Changeset
- Label Position: Top
- Name: ChangesetLink
- In the properties panel, find the Control Settings property and click the ... button to the right of "LinksControlOptionsType".
- If you see an error that says "Failed to load Control Settings" you should be able to safely dismiss it.
- On the XML tab, enter the following code and click OK:
<LinksControlOptionsType> <LinkColumns> <LinkColumn RefName="System.Title" /> <LinkColumn LinkAttribute="System.Links.Comment" /> </LinkColumns> <WorkItemLinkFilters FilterType="excludeAll" /> <ExternalLinkFilters FilterType="include"> <Filter LinkType="Fixed in Changeset" /> </ExternalLinkFilters> </LinksControlOptionsType>
- Update the server with your changes.
- Save the file. This will create one file with a
.wit
extension and one with a.xml
extension. - Go to Tools > Process Editor > Work Items > Import WIT.
- In the Connect to Team Project Collection dialog, select the appropriate collection and click Connect.
- In the Import Work Item Type Definition dialog, select the team project from the list.
- Click Browse..., select the
.XML
file, and click Open. Then click OK.
- Save the file. This will create one file with a
Adding the link
After updating the work item type definition, users may first need to click the refresh button in Team Explorer or in the browser the changes will be recognized.
Using Visual Studio
- Open the Code Review Request
- Use Team > Go to Work Item..., OR
- Enter the code review id in Team Explorer's Search Work Items field.
- Open the work item form by clicking Actions in the Team Explorer pane, and then click Open Work Item #
- Navigate to the Links tab, scroll down to the Changeset control, and click Link to.
- Enter the changeset id and click OK.
Using the TFS Web Interface
- Open the TFS web interface.
- Enter the code review id in the Search work items field.
- Navigate to the Links tab, scroll down to the Changeset control, and click Link to.
- Enter the changeset id and click OK.
Note that you can also conduct a code review on a checked-in changeset by going to the history right-clicking on the changeset and selecting