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.

image

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

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

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:

image

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

image

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:

image

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:

image

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:

image

If you get stuck, feel free to leave a comment.

About Wes MacDonald

Wes MacDonald is a DevOps Consultant for LIKE 10 INC., a DevOps consulting firm providing premium support, guidance and services for Azure, Microsoft 365 and Azure DevOps.

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: