How to: Link from Model Elements to Work Items

In Visual Studio Ultimate, you can link any model element to work items in Team Foundation Server. This lets you track tasks, test cases, bugs, requirements, issues, or other kinds of work that are associated with specific parts of your model. You can also associate any document to a model element by attaching the document to a linked work item.

Note

You can make these links only if your project uses Team Foundation Server and you have Team Explorer installed on your computer. To create links and view links from work items, download and install Microsoft Visual Studio 2010 Visualization and Modeling Feature Pack. For more information, see How to: Link from Work Items to Model Elements.

As examples, you could make these links:

  • Link a User Story work item to an activity diagram that explains how the story is realized as a sequence of operations.

  • Link a use case in a Use Case Diagram to the Test Case work items that will make sure that it is implemented correctly.

  • Link an attribute in a class in a UML Class Diagram to a Bug work item about an error in the implementation of the attribute.

  • Link a component in a component diagram to a Task work item that tracks its development. Such a Task would usually be the parent of several smaller Tasks.

You can link work items to any element that you can select in the diagrams or UML Model Explorer. This includes the following:

  • All elements in UML models, such as UML classes, lifelines, use cases, subsystems, activities, object nodes, components, interfaces

  • All relations in UML models, such as associations, generalizations, dependencies, flows, messages

  • Parts of elements, such as the attributes and operations of classes, the execution occurrences of lifelines, the input and output pins of activities, and the parts and ports of components

  • Layers and layer dependencies

  • Comments and comment links

  • Diagrams. To select a diagram, click in a blank part of the diagram.

In This Topic

  • To connect to a Team Foundation server

  • To link a model element to a new work item

  • To link a model element to an existing work item

  • To open the work items linked to a model element

  • To remove work item links from a model element

To connect to a Team Foundation server

  1. On the View menu, click Team Explorer.

  2. If the correct server and projects are not displayed, click Add Existing Team Project, and choose the correct server and projects.

  3. In Team Explorer, click the project in which you want to create, link, or view work items.

    The project appears highlighted in Team Explorer.

  1. In Team Explorer:

    1. Make sure that you are connected to the Team Foundation Server in which you want to create a new work item.

    2. Make sure that you have selected the project in which you want to create new work items by clicking the project in Team Explorer.

  2. Right-click the model element on a diagram or in UML Model Explorer, point to Create Work Items, and then click the type of work item that you want.

    A work item form appears.

  3. Fill the fields of the work item, and then click Save Work Item.

    The new work item is linked to the model element. An icon appears on or near the model element.

    Important

    In this release, a link points in one direction only, from the model element to the work item. To enable bidirectional links between model elements and work items, install the Microsoft Visual Studio 2010 Visualization and Modeling Feature Pack. This means that when you create a link from a UML model element to a work item, a link from the work item to the model element will also be created. To see this link in the work item, open the work item and refresh it manually, or close and then reopen your query. To enable bidirectional links between layer elements and work items, install Visual Studio 2010 Service Pack 1. Otherwise, you will have to create the link from the work item. For more information, see How to: Link from Work Items to Model Elements.

  1. In Team Explorer, make sure that you are connected to the Team Foundation Server that contains the work items that you want.

  2. Right-click the element on the diagram or in UML Model Explorer, and then click Link to Work Item.

    The Link to Work Items dialog box appears.

  3. Select your project in the Project field.

  4. Choose one or more work items to link to the model element, using one of the following methods:

    • Choose a query in Saved Query.

    • Type the IDs of one or more work items, separated by spaces.

    • Type a word or phrase in Title Contains.

  5. Click Find.

    A list of work items appears.

  6. Select the check boxes for the work item or work items that you want, and then click OK.

    The Work Items property of the model element shows a larger number than before. An icon appears on or near the model element.

    Important

    In this release, a link points in one direction only, from the model element to the work item. To enable bidirectional links between model elements and work items, install the Microsoft Visual Studio 2010 Visualization and Modeling Feature Pack. This means that when you create a link from a UML model element to a work item, a link from the work item to the model element will also be created. To see this link in the work item, open the work item and refresh it manually, or close and then reopen your query. To enable bidirectional links between layer elements and work items, install Visual Studio 2010 Service Pack 1. Otherwise, you will have to create the link from the work item. For more information, see How to: Link from Work Items to Model Elements.

To open the work items linked to a model element

  1. In Team Explorer, make sure that you are connected to the Team Foundation Server to which the model element is linked.

  2. Right-click the model element on the diagram or in UML Model Explorer, and then click View Work Items.

    A work item list window opens and shows a list of connected work items.

    Note

    Only work items in the currently selected server will be displayed. If the list is empty, check that you have selected the correct server in Team Explorer.

  1. In Team Explorer, make sure that you are connected to the Team Foundation Server to which the model element is linked.

  2. Right-click the model element on the diagram or in UML Model Explorer, and then click Remove Work Items.

    - or -

    1. Right-click the model element on the diagram or in UML Model Explorer, and then click Properties.

      In the Properties window, the Work Items property shows the number of linked work items.

    2. Click the ellipsis button […] in the Work Items property.

    The Remove Links to Work Items dialog box appears.

    Note

    Only work items in the current server will be displayed. If the list is empty, but the number of work items is not zero, verify that you are connected to the correct server in Team Explorer.

  3. Clear the check boxes next to the items that you want to unlink, and then click OK.

    The work items are no longer linked to the model element.

    Important

    When you remove a link from a model element, the link from the work item to the element is also removed. It is not recommended that you edit the work item to remove the link to the model element because the link from the model element to the work item will not be removed. Instead, remove the work item link from the model element.

See Also

Concepts

How to: Edit a UML Model and Diagrams

Developing Models for Software Design