Update a TFS team project manually to support code reviews

If you are working with TFS and have projects created in older versions you might want to use features available in newer versions of TFS (given that you have updated to such a newer version). These features could be code reviews, feedback, my work, storyboarding, and others. In this post, I will explain how to manually modify the team project settings to enable code review. You can only do this is you have proper access rights.

If you updated to TFS 2013/2015/2017/2018 and you go to My Work in Team Explorer, you get the following error:

To use My Work to multi-task and manage your changes, you must enable the feature on the server.
Click here to enable the new features

When you do that, you are directed to the administrative control panel, if you have appropriate access rights. Under your project’s profile you can find a link to configure features.

However, when you do that you will probably discover that your project cannot be configured automatically.

To configure the project manually, follow these steps:

  1. In Visual Studio, go to Team > Team Project Collection Settings > Process Template Manager… and open it. From the manager window, download the appropriate process template. In this example I am using Microsoft Visual Studio Scrum 2013. You are prompted to select a folder where the template files will be stored. For this example, let’s consider it was downloaded to your Documents folder.
  2. Locate the witadmin.exe tool. For instance, for Visual Studio 2017 Professional the location is c:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\.
  3. Run the following commands to import code review work item types:
    witadmin importwitd /collection:<yourcollectionurl> /p:<yourprojectname> /f:"c:\Users\<yourusername>\Documents\Microsoft Visual Studio Scrum 2013\WorkItem Tracking\TypeDefinitions\CodeReviewRequest.xml"
    
    witadmin importwitd /collection:<yourcollectionurl> /p:<yourprojectname> /f:"c:\Users\<yourusername>\Documents\Microsoft Visual Studio Scrum 2013\WorkItem Tracking\TypeDefinitions\CodeReviewResponse.xml"
  4. Run the following command to export the work item types categories:
    witadmin exportcategories /collection:<yourcollectionurl> /p:<yourprojectname> /f:"c:\Users\<yourusername>\Documents\categories.xml"
  5. Open the categories.xml file in notepad (or any other text editor). The file may look like this:
    <?xml version="1.0" encoding="utf-8"?>
    <cat:CATEGORIES xmlns:cat="http://schemas.microsoft.com/VisualStudio/2008/workitemtracking/categories" />

    Modify the file to add the following categories:

    <?xml version="1.0" encoding="utf-8"?>
    <cat:CATEGORIES xmlns:cat="http://schemas.microsoft.com/VisualStudio/2008/workitemtracking/categories">
      <CATEGORY name="Code Review Request Category" refname="Microsoft.CodeReviewRequestCategory">  
        <DEFAULTWORKITEMTYPE name="Code Review Request" />  
      </CATEGORY>
      <CATEGORY name="Code Review Response Category" refname="Microsoft.CodeReviewResponseCategory">  
        <DEFAULTWORKITEMTYPE name="Code Review Response" />  
      </CATEGORY>
      <CATEGORY name="Hidden Types Category" refname="Microsoft.HiddenCategory">  
         <DEFAULTWORKITEMTYPE name="Code Review Request" />  
         <WORKITEMTYPE name="Code Review Response" />  
      </CATEGORY>  
    </cat:CATEGORIES>
  6. Run the following command to import the work item types categories from the file you just modified:
    witadmin importcategories /collection:<yourcollectionurl> /p:<yourprojectname> /f:"c:\Users\<yourusername>\Documents\categories.xml"

If you check your projects features in the administrative panel, the code review features should be enabled.

If you open the My Work panel in the Team Explorer there error you previously got should be gone and you can start using the code review functionality.

Here is a list of articles you might want to read for further information:

6 Replies to “Update a TFS team project manually to support code reviews”

  1. Wow, mai exista cineva care foloseste TFS in 2018? Pana si cei de la Microsoft (care l-au dezvoltat) au trecut la git…

  2. Din pacate te contrazic 🙂

    Daca pana si cei de la Microsoft au renuntat la tool-urile lor in favoarea git-ului, iar git-ul creste pe zi ce trece inclusiv pentru proiecte foarte mari…
    Microsoft de exemplu tine 300GB in git, desi stiu ca l-au modificat putin pentru nevoile lor.

    https://arstechnica.com/information-technology/2017/02/microsoft-hosts-the-windows-source-in-a-monstrous-300gb-git-repository/

    https://blogs.msdn.microsoft.com/bharry/2017/05/24/the-largest-git-repo-on-the-planet/

  3. Si ca o paranteza, proiectul la care lucrez la serviciu are cam 2GB (30.000 fisiere), serverul de git este in Germania si vreau sa zic ca orice comanda de git dureaza mai putin de o secunda. In afara de clone, desigur, care dureaza cam 1 minut.
    Desigur discutam despre server de git local, nu pe github.com.

  4. Thanks for the post.

    I followed the same steps and confgiured successfully. When i tried to assign code review, i got the error “The identity value ‘fb425133-f429-471d-b379-8c96cabd62f9’ for field ‘Associated Context Owner’ is an unknown identity.”. Please advise

  5. Thank you so much, I was struggling with this for hours. I accidentally used Microsoft.VSTS.CodeReviewRequestCategory instead of Microsoft.CodeReviewRequestCategory, which I realized when I spot that out in your guide. Thanks again for taking the time to share this!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.