# TFS and MS Project : Adding Duration from MS Project into Task Work Item

I am going to step through an example of adding the “Duration” field from MS Project into an Agile Task Work Item.

First download a copy of the MS Project field mapping file from the Team Project.

Open a Visual Studio 2008 Command Prompt and execute the following command:

Open the Task Work Item from the Team Project using the TFS Power Tools in Visual Studio, click Tools | Process Editor | Work Item Types | Open WIT from Server

Select the Team Project and the Task Work Item Type

Add a new “Field” to the Work Item Type:

On the Layout Tab add the new control to hold the value from MS Project as shown below:

Save the change and it will immediately update the Task Work Item Type for that Team Project

Now open the MS Project mapping file in Visual Studio you downloaded in the first step and add the following line to define the mapping of the “Duration” value:

<Mapping WorkItemTrackingFieldReferenceName="Microsoft.VSTS.Scheduling.Duration" ProjectField="pjTaskDuration" PublishOnly="true" ProjectUnits="pjDay"/>

Save the mapping file and upload it back to the server:

Open a Visual Studio 2008 Command Prompt and execute the following command:

C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7>tfsfieldmapping upload http://%5BtfsServer%5D:8080 [projectName] c:\tmp\projmap.xml

Open MS Project and update the information for the Tasks like this:

Click the “Publish” button to push the changes back to TFS.

Now when you open a Task in Team Explorer it should display the information as shown below, this is Work Item ID #60 from above: