Jaa


TFVC code review in Visual Studio

TFS 2018

Visual Studio 2019 | Visual Studio 2022

You can use Visual Studio to request code reviews, respond to review requests, and suspend and resume work for Team Foundation Version Control (TFVC).

If you're using Git source control instead of TFVC, use a pull request for code reviews.

Note

Visual Studio My Work and Code Review features are available with the following editions:

  • Visual Studio 2022: Visual Studio Community, Visual Studio Professional, and Visual Studio Enterprise
  • Visual Studio 2019: Visual Studio Professional and Visual Studio Enterprise

Prerequisites

Before you ask for a code review, make sure you've shared your code in TFVC.

Request a code review

Before you check in code, you can use Visual Studio to ask someone else from your team to review it. Your request appears in the recipient's Team Explorer window on the My Work page.

To request a code review, before you check in a change:

  1. Go to the My Work page in Team Explorer.

    Screenshot of My Work from the Team Explorer home page.

  2. On the My Work page, select Request Review.

    Screenshot of Request Review link from the Team Explorer My Work page.

  3. On the New Code Review page, enter the reviewer name or names and a subject for the code review, and then select Submit Request.

    Screenshot of the Submit Request button and filled out New Code Review page in Team Explorer.

  4. You can suspend your work so you can work on something else while you wait to hear back from the code review. On the My Work page of Team Explorer, select Suspend in the In Progress Work section, optionally enter a different name for the suspended work, and then select Suspend.

    Screenshot of the Suspend link on the My Work page of Team Explorer.

Respond to the code review request

Requested reviewers see the code review request in Team Explorer, look at the changes, and give their feedback. To respond to a review request:

  1. On the My Work page of Team Explorer, locate the review request.

    Screenshot of a review request on the My Work page of Team Explorer.

  2. To open the code review, double-click the request, or right-click it and select Open.

  3. From the Code Review page, you can select the changed files to review the differences.

    Screenshot of the file link on the Code Review page.

  4. To add comments, in the difference window, select the code to comment on, right-click, and select Add comment. You can also press Ctrl+Shift+K.

    Screenshot showing a comment added and the Send Comments button.

  5. Select Send Comments to send the comments.

You can get email alerts for code reviews, too. To sign up, select Project Alerts under Team Project on the Settings page in Team Explorer.

Screenshot showing the Project Alerts link on the Settings page of Team Explorer.

Update the code based on the review feedback

When you get the code review results, you can resume work on the project.

  1. On the My Work page in Team Explorer, select Resume under Suspended Work.

    Screenshot showing the Resume link on the My Work page of Team Explorer.

    Your changes are unshelved and the windows you had opened are restored, so you can incorporate the review feedback.

  2. On the Code Review page, you can close the review by selecting Close Review and then selecting Complete if the review is finished, or Abandon if you don't plan to finish it.

Next steps