Exporting work item definition fromTFS 2012
This guide is specific to TF2012 and VS2012.All commands you will need to run from Developer Command Prompt for VS2012.
Get list all all items existing
First lets check what work items do we have in our project collection:
Command example
witadmin listwitd /collection:http://TfsServer:8080/tfs/DefaultServices /p:ProjectName
where
- listwitd - list of work items
- /collection: select tfs server and your Team Project Collection
- /p:Project Name Work item for project
Export the work item
Exporting template to xml file. This file you can modify using your Visual StudioThis one will fail
witadmin exportwitd /collection:http://TfsServer:8080/tfs/DefaultServices /p:ProjectName /f:UserStory.xml /n:User Story
The reason for fail is user story has to be surrounded in double quotes
TF212000: Story is not a valid argument for this command. Type 'witadmin exportwitd /?' or 'witadmin help exportwitd' and press Enter for more information.
Update command as follows:
witadmin exportwitd /collection:http://TfsServer:8080/tfs/DefaultServices /p:ProjectName /f:UserStory.xml /n:"User Story"
Update your work item template
When creating new fields into work item template make sure that you use name starting with unique prefix (for example: CompanyName.MyFieldName) and it is not only name of the field. This is to distinguish between custom fields and default build ones.Validate your work item
To validate your updated template you can run command:witadmin importwitd /collection:http://AdventureWorksServer:8080/tfs/DefaultCollection /f:WorkItemFileName.xml /p:ProjectName /v
The result should be for valid collection.
The work item type is valid.
Import work item to project
To add new work item to tfs you can run command:witadmin importwitd /collection:http://TfsServer:8080/tfs/DefaultServices /f:WorkItemFile.xml
The work item type import has completed.
Destroy work item
Delete work itemitemwitadmin destroywitd /collection:http://TfsServer:8080/tfs/DefaultServices /p:ProjectName /n:WorkItemName
Are you sure you want to destroy the NewBug work item type as well as its 0 wo
rk item(s)? This action is not recoverable. (Yes/No) y
The work item type was destroyed.
Having an issue with importwitd, maybe you can help. I am editing the process template I have gotten from the server. When I am done I have a powershell script that I run to loop through all projects and all work item types and I call importwitd on each. When the script is finished I open the wit from the server in Visual Studio, and I do not see my changes. Is there something else that needs to be done to apply the changes?
ReplyDeleteJason,
ReplyDeletedid you checked out your solution, and after commited changes?
Pav