Partager via


Create a work item type

You can create a work item type by starting with the sample code in this topic. A work item type defines the rules, fields, states, and transitions for an item of work that will be tracked on a team project, such as bugs, requirements, and risks. The work item type is specified in a type definition XML file under the Work Item Tracking folder in the TypeDefinitions folder. For example, Microsoft Solutions Framework (MSF) for Agile Software Development defines Bug, Quality of Service, Scenario, Risk, and Task work item types in the files Bug.xml, QoS.xml, Scenario.xml, Risk.xml, and Task.xml, respectively.

You can customize or create type definition files in the TypeDefinitions folder. Then you can import your new work item type to a single project, or you can add it to your process template and upload the modified template to your Team Foundation Server.

Required Permissions

To perform this procedure, you must be a member of the Team Foundation Administrators group or a member of the Project Administrators group for the project. For more information, see Permission reference for Team Foundation Server.

To create a work item type

  1. In Visual Studio, create an XML file for your work item type. To do this, on the File menu, click New, and then click File.

  2. In the New File dialog box, under Categories, select General, and then under Templates, select XML File.

  3. Copy and paste the following code into the file:

    <?xml version="1.0" encoding="utf-8"?>
    <witd:WITD application="Work item type editor" version="1.0" xmlns:witd="https://schemas.microsoft.com/VisualStudio/2008/workitemtracking/typedef">
    <WORKITEMTYPE name="New Work Item Type Name">
    <DESCRIPTION>A description of your new work item type.</DESCRIPTION>
    <GLOBALLISTS>
    </GLOBALLISTS>
    <FIELDS>
          <FIELD name="Title" refname="System.Title" type="String" reportable="dimension">
            <REQUIRED />
          </FIELD>
    </FIELDS>
    <WORKFLOW>
          <STATES>
            <STATE value="Active">
            </STATE>
          </STATES>
          <TRANSITIONS>
            <TRANSITION from="" to="Active">
              <REASONS>
                <DEFAULTREASON value="New" />
                <REASON value="Build Failure" />
              </REASONS>
            </TRANSITION>
           </TRANSITIONS>
    </WORKFLOW>
    <FORM>
          <Layout>
            <Group>
              <Column PercentWidth="100">
                <Control Type="FieldControl" FieldName="System.Title" Label="&amp;Title:" LabelPosition="Left" />
              </Column>
            </Group>
          </Layout>
    </FORM>
    </WORKITEMTYPE>
    </witd:WITD>
    
  4. Click Save to save the changes. In the Save File As dialog box, name the file, and save it as an .xml file.

    If you are creating a work item type to customize a process template, move to the location where you want to downloaded the process template and save your file in the \WorkItem Tracking\TypeDefinitions folder.

    Note

    If you are running Windows Vista you might not have permissions to certain folders. If you try to export the work item type to a location where you do not have permissions set, the registry virtualization technology automatically redirects the exported file and saves it to the virtual store. To avoid this redirection, you can export the file to a location where you have permissions set. For more information about registry virtualization, see the Microsoft Web site: Registry Virtualization and Common file and registry virtualization issues in Windows Vista.

  5. To customize your work item type, see Modify or add a field to support queries, reports, and workflow.

  6. To import the new work item type to a single project, see Import, export, and manage work item types [witadmin]. To add the work item type to your process template, see Add type definitions for work items to a process template.

See Also

Reference

Import, export, and manage work item types [witadmin]

Concepts

All WITD XML elements reference

Other Resources

Work item tracking: Index to XML element definitions