This documentation is archived and is not being maintained.

How to: Delete a Work Item Type Field

You can delete work item type fields from an existing project using the Visual Studio Command Prompt and the witfields command-line tool. For more information, see witfields.

Required Permissions

To perform this procedure you must be a member of the Team Foundation Administrators group. 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.

    NoteNote:

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

To delete fields

  1. Open a Visual Studio Command Prompt window.

  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. Try to delete a field that from Team Foundation Server. To do this, type the following at the Visual Studio command prompt, and then press ENTER.

    witfields delete /s:"Team Foundation Server name" MyCompany.MyProcess.MyField

    A message is returned that states that the field cannot be deleted because it is being used by a team project.

  4. Run witexport to re-export the XML file for the work item type you want to modify. For more information, see How to: Export a Work Item Type from an Existing Project.

  5. In Visual Studio, click File, click Open, and then click File.

    This displays the Open File dialog box.

  6. Under Look in, move to the location where you exported the file.

    If you are modifying a work item type to customize a process template, move to the location where you downloaded the process template.

    NoteNote:

    If you are running Windows Vista, you might not have access rights to certain folders. If you try to export the work item type to a location where you do not have access rights, the registry virtualization technology automatically redirects the exported file and saves it to the virtual store. For more information, see http://go.microsoft.com/fwlink/?LinkId=92325 and http://go.microsoft.com/fwlink/?LinkId=92323. To avoid this redirection, you can export the file to a location where you have access rights.

  7. Select the work item type XML file that you want to update, and then click Open. When you are prompted about line endings, click No.

  8. Find and delete the definition of the field you want removed from the work item type. The following example shows a field named Category. You would delete the following field section to remove the Category field.

    NoteNote:

    The field section in your XML file may not contain all the elements listed below. However, if you have customized the work item type field to include these elements, they must be deleted also.

    <FIELDS>
    …
    <FIELD name="Category" refname="MyCompany.MyProcess.Category" type="String" reportable="dimension">
    <HELPTEXT>Describes the category to which this special task belongs.</HELPTEXT>
      <WHEN field="Microsoft.VSTS.Common.Discipline" value="Business Analyst">
        <ALLOWEDVALUES>
          <LISTITEM value="Planning" />
          <LISTITEM value="Review" />
        </ALLOWEDVALUES>
      </WHEN>
      <WHENNOT field="Microsoft.VSTS.Common.Discipline" value="Business Analyst">
        <ALLOWEDVALUES>
          <LISTITEM value="Process Management" />
          <LISTITEM value="Planning" />
          <LISTITEM value="Execution" />
          <LISTITEM value="Review" />
        </ALLOWEDVALUES>
      </WHENNOT>
    </FIELD>
    …
    </FIELDS>
    
  9. In the <Layout> section, find the following XML, and delete the highlighted sections to remove the field:

    <Group Label="Classification">
      <Column PercentWidth="50">
        <Group>
          <Column PercentWidth="100">
            <Control Type="WorkItemClassificationControl" FieldName="System.AreaPath" Label="Area" LabelPosition="Left" />
            <Control Type="WorkItemClassificationControl" FieldName="System.IterationPath" Label="Iteration" LabelPosition="Left" />
          </Column>
        </Group>
      </Column>
      <Column PercentWidth="50">
        <Group>
          <Column PercentWidth="100">
            <Control Type="FieldControl" FieldName="MyCompany.MyProcess.Category" Label="Category" LabelPosition="Left" />
          </Column>
        </Group>
      </Column>
    </Group>
    
  10. On the File menu click Save <file name> to save changes to the XML file.

  11. Import the changed work item type into Team Foundation Server. For more information, see How to: Import a Work Item Type to an Existing Project.

  12. Verify that the field is no longer being used by any work item types by typing the following at the command prompt, and then pressing ENTER.

    witfields view /s:"Team Foundation Server name" MyCompany.MyProcess.MyField

    The witfields tool shows that the field is "Not In Use."

    Field: MyCompany.MyProcess.MyField

    Name: MyField

    Type: String

    Reportable As: dimension

    Use: Not In Use

  13. Now that the field is no longer used by any work item types, delete the field permanently from Team Foundation Server by typing the following text at the command prompt, and then pressing ENTER. Enter y at the confirmation prompt to complete this step.

    witfields delete /s:"Team Foundation Server name" MyCompany.MyProcess.MyField

Show: