How to Add a Custom Work Item to a Category In TFS
May 20. 2011 Posted in:
I recently had to make a custom work item type using the TFS 2010 Power Tools. However, the requirements search in Test Center didn’t return any results for work items of this new type. The problem was, TFS has a concept of work item categories (or “groups”), and my new work item type needed to be in the “requirements” group.
To add a new work item type to a work item category you have to use witadmin. Open a VS2010 command prompt and get the categories like this:
C:\Users\Administrator\Documents>witadmin exportcategories /collection:http://win-gs9gmujits8:8080/tfs/defaultcollection /p:"My Project Name" /f:categories.xml
Then this MSDN article explains the syntax of the categories xml file. I added my custom work item type in like this:
<CATEGORY refname="Microsoft.RequirementCategory" name="Requirement Category">
<DEFAULTWORKITEMTYPE name="User Story" />
<WORKITEMTYPE name="My Custom Work Item Type" />
</CATEGORY>
Then you reimport them using the witadmin
tool again:
C:\Users\Administrator\Documents>witadmin importcategories /collection:http://win-gs9gmujits8:8080/tfs/defaultcollection /p:"My Project Name" /f:categories.xml
And now Testing Center is able to assign the new work item types as requirements.