How to: Rename a Work Item Type Field

You can use the command-line tool witfields to rename work item type fields for an existing project from the Visual Studio 2008 command prompt. For more information, see witfields.

To view a list of work item type fields available on your Team Foundation Server, see How to: View a Work Item Type Field.

Required Permissions

To perform this procedure you must be a member of the Team Foundation Administrators group or a member of Project Administrators group for all projects where the field is used. For more information, see Team Foundation Server Permissions.

To use Team Foundation commands at the command prompt

  • Click Start, click All Programs, point to Microsoft Visual Studio 2008, point to Visual Studio Tools, and then click Visual Studio 2008 Command Prompt.

    Alternatively, you can run vsvars32 in the Visual Studio installation path; usually DriveLetter:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools.

    Note

    You must have Visual Studio installed to use the Visual Studio 2008 Command Prompt.

To rename fields

  1. Open a Visual Studio command prompt.

  2. Change directory to the location of the assembly that contains the work item types, by typing the following command, and then pressing ENTER.

    cd ..DriveLetter:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies

  3. At the Visual Studio command prompt, type the following, and then pressing ENTER.

    witfields rename /s:"<Team Foundation Server name>" Microsoft.VSTS.Common.Rank Importance

    This command renames the Rank field to Importance.

  4. At the confirmation prompt type y and then press ENTER. Wait until you receive the following message:

    Field renamed.

  5. In the Team Explorer window in Visual Studio, click Refresh to download the latest updates from the server.

    Wait several seconds until all the nodes are loaded. Nodes that are still loading display working.

  6. Right-click the Work Items node, and then select Add Query to create a new query.

  7. Click the area labeled Click here to add a clause to add a new row, select the blank Field cell, and in the cell, type Rank. Notice the following message that appears above the results list. This message indicates that the Rank cannot be found.

    Run the query to see the query results. TF51005: The query references a field that does not exist. The error is caused by <<Rank>>.

  8. Delete the value Rank from the Field cell, and type Importance into the cell.

  9. Select <> in the Operator cell, and type 1 into the Value cell.

  10. From the Team menu, click Run Query.

  11. Right-click any row in the results and select Column Options. Scroll down in the Availablecolumns list. Notice that the Rank field is no longer present but the Importance field is present.

  12. Select Importance in the Available columns box, and then click the add selected columns button, (>). Click OK.

    Notice that the friendly name for Microsoft.VSTS.Common.Rank has been renamed from Rank to Importance throughout the query builder and results list.

  13. Click Close to close the query. Click No when you are prompted to save the query.

  14. Create a new Task work item. To do this, right-click the Work Items node, point to Add Work Item, and then click Task.

    This work item is created from the work item type that you changed and imported.

  15. Notice, in the Status box, that the label for the renamed field, Rank, has not changed. This is because the field labels on the work item forms are scoped to the parent team project and are independent of the server-wide field name just specified.

    Note

    For more information about how to change field labels on work item forms, see How to: Customize a Field Label.

  16. Click Close to close the new Task. Click No when you are prompted to save the work item.

See Also

Tasks

How to: Add a Field to a Work Item Type

How to: View a Work Item Type Field

How to: Delete a Work Item Type Field

Reference

witfields