Reference

Integrating Project 2010 Scheduling Columns with TFS 2010

Microsoft Project 2010 has out-of-the-box support for Team Foundation Server 2010, and the relevant features become available automatically right after Team Explorer is installed on the client computer. One feature that first appears to be missing is the integration of Project’s start and finish dates for bug and task work items. This article describes how to enable support for those columns.

Tags: infrastructure project tfs

Prerequisites

The paragraphs below assume that you have already successfully installed the following software:

It is also assumed that you know how to locate and interact with Visual Studio or Visual Studio Team Explorer, as well as Team Web Access.

Editing The Work Item Templates

Interestingly, both Project 2010 and TFS 2010 already have support for scheduling related columns, and these columns are already mapped to each other. The Start and Finish columns in particular are also published to and stored correctly in the work items in TFS 2010. However, the work item templates do not display these values by default, causing them to be inaccessible in the work item detail views of both Team Explorer and Team Web Access.

However, work item templates can easily be modified and customized to our needs using the following steps:

  1. Open Visual Studio or Visual Studio Team Explorer
  2. In the main menu, click Tools → Process Editor → Work Item Types → Open WIT from Server
  3. In the Select Work Item Type dialog, select the work item type in the team project you wish to modify
  4. In the Work Item Type editor, note that fields for Start Date and Finish Date are already present; switch to the Layout tab
  5. Modify the existing layout tree to include new groups, columns and and input fields for the desired values. I used the following changes for my layout:
    • Before the TabGroup that contains the work item details, add a Group with an empty label
    • In the new group, add two Columns, both of which have a PercentWidth of 50
    • In the first column, add a Group with the label Scheduling
    • Inside that group, add two more columns with a Percentwidth of 50
    • In the first column, add a new control with a Field Name of Microsoft.VSTS.Scheduling.StartDate, a Label of &Start Date:, and a Type of DateTimeControl
    • In the second column, add a new control with a Field Name of Microsoft.VSTS.Scheduling.FinishDate, a Label of &Finish Date:, and a Type of DateTimeControl
    • Click Preview to verify the layout changes
    • Upload the modifications by clicking the Save button in the main menu tool bar.

You have to repeat these steps for each work item type.

The following images show the changes in the layout tree as described above and how they appear in the actual work item editor:

!(Work Item Template Screenshot)[workitemtemplate1.jpg] !(Work Item Editor Screenshot)[workitemeditor1.jpg]

Adjusting Column Mappings

At this point you should be able to see the start dates and end dates of all work items that were published from Project 2010 into TFS. However, you may notice that these fields only flow one way, and when syncing Project from TFS, their values are lost. This behavior is by design, because Project calculates the values for the scheduling fields based on start date, duration and task dependencies. TFS on the other hand simply populates those fields based on user input. The one-way mapping ensures that values in TFS do not override those in Project.

When Project is used as the primary scheduling tool, however, this may not be desirable. There are basically two ways around this: save the Project file locally on the client computer’s disk, in which case the scheduling columns are preserved in the file, or adjust the column mappings to allow a bidirectional transfer. The first way may be sufficient when there is only a single person managing the schedule, or if the Project file is stored on a shared network folder location. If you want to support syncing Project from TFS, then the second option is the way to go.

Modifying the mappings is currently not possible from within the visual tool set, and a command line tool named TFSFieldMapping.exe needs to be used, which is basically a 3-step process:

  1. Download the mapping file from TFS
  2. Modify the mappings in a text editor
  3. Upload the modified mapping file to TFS.

Downloading the Mapping File

To download the mapping file from the server, perform the following steps:

  1. Open a command prompt (cmd.exe
  2. Change the directory to the folder where Visual Studio is installed, i.e. C:\Program Files\Microsoft Visual Studio 10\
  3. Continue to navigate to the folder: Common 7\IDE\
  4. Execute the following command (with placeholders filled in):
    TFSFieldMapping.exe download /collection:[collectionUrl] /teamproject:[projectname] /mappingfile:[targetpath]

    for example:

    TFSFieldMapping.exe download /collection:http://myserver/tfs/MyProjectCollection /teamproject:MyProject /mappingfile:mymappingfile.xml

Editing the Mapping File

To edit the file, perform the following steps:

  1. Open the mapping file downloaded with the previous steps in a text editor of your choice
  2. Locate the mappings for Microsoft.VSTS.Scheduling.StartDate and Microsoft.VSTS.Scheduling.FinishDate
  3. Delete the PublishOnly attributes
  4. Save the file.

Uploading the Mapping File

To upload the mapping file to the server, use the same command line as for downloading, except for replacing the download parameter with upload:

  1. Open a command prompt (cmd.exe)
  2. Change the directory to the folder where Visual Studio is installed, i.e. C:\Program Files\Microsoft Visual Studio 10\
  3. Continue to navigate to the folder: Common 7\IDE\
  4. Execute the following command (with placeholders filled in):
    TFSFieldMapping.exe upload /collection:[collectionUrl] /teamproject:[projectname] /mappingfile:[targetpath]

    for example:

    TFSFieldMapping.exe download /collection:http://myserver/tfs/MyProjectCollection /teamproject:MyProject /mappingfile:mymappingfile.xml

Your configuration is now setup to synchronize the scheduling columns of work items between Team Foundation Server and Project 2010, and to display them in the work item editors in both Team Explorer and Team Web Access.

Related Resources