[TFSINTEGRATION] HowTo: Define custom mappings for the migration between TFS2008 and TFS2010

image47dd1de4

Good,

When you work with tfs integration platform a scenario very likely:

Migrating the contents of a Team Project from Team Foundation Server 2008 at Team Foundation Server 2010.

While the basic concepts of WorkItem Tracking and Source Control remained similar between the two versions, process templates have changed considerably and the migration of WorkItems can bring us some headaches. If them you have customized or extended, so much more. In these cases, we will have to modify the definition of a migration project for it, define custom mappings to solve these cases.

Define a type of different WorkItem

The following Xml defines a configuration where all the elements of the WorkItem Type [Error] will migrate to the WorkItem Type [Bug]. In this mapping the fields of both WorkItem Types must match to run the migration process.

   1: <SettingXml>
   2:   <WITSessionCustomSetting>
   3:     <WorkItemTypes>
   4:       <WorkItemType LeftWorkItemTypeName="Error" RightWorkItemTypeName="Bug" fieldMap="@@ALL@@" />
   5:     </WorkItemTypes>
   6:   </WITSessionCustomSetting>
   7: </SettingXml>
   8: <SettingXmlSchema />

Define a type of different WorkItem with custom fields mapping

The following Xml defines a configuration where all the elements of the WorkItem Type [Error] will migrate to the WorkItem Type [Bug], using a special mapping of fields for different fields in both definitions. In this case the special mapping is called [Error2BugFieldMap] and it defines the names of the fields and the corresponding mappings between them.

   1: <SettingXml>
   2:   <WITSessionCustomSetting>
   3:     <WorkItemTypes>
   4:       <WorkItemType LeftWorkItemTypeName="Error" RightWorkItemTypeName="Bug" fieldMap="Error2BugFieldMap" />
   5:     </WorkItemTypes>
   6:     <FieldMaps>
   7:       <FieldMap name="Error2BugFieldMap">
   8:         <MappedFields>
   9:           <MappedField LeftName="Headline" RightName="System.Title" MapFromSide="Left" valueMap="" />
  10:           <MappedField LeftName="Headline" RightName="System.Title" MapFromSide="Right" valueMap="" />
  11:           <MappedField LeftName="State" RightName="System.State" MapFromSide="Left" valueMap="" />
  12:           <MappedField LeftName="State" RightName="System.State" MapFromSide="Right" valueMap="" />
  13:           <MappedField LeftName="Description" RightName="System.Description" MapFromSide="Left" valueMap="" />
  14:           <MappedField LeftName="Description" RightName="System.Description" MapFromSide="Right" valueMap="" />
  15:         </MappedFields>
  16:       </FieldMap>
  17:     </FieldMaps>
  18:   </WITSessionCustomSetting>
  19: </SettingXml>
  20: <SettingXmlSchema />

Define a custom mapping of fields with different WorkItem type and custom values

The following example extends the previous scenario as for the mapping of fields, also defines a number of dictionaries where are the mappings of values custom among the fields of each type of WorkItem (examples on lines 11 and 19).

   1: <SettingXml>
   2:   <WITSessionCustomSetting>
   3:     <WorkItemTypes>
   4:       <WorkItemType LeftWorkItemTypeName="Error" RightWorkItemTypeName="Bug" fieldMap="Error2BugFieldMap" />
   5:     </WorkItemTypes>
   6:     <FieldMaps>
   7:       <FieldMap name="Error2BugFieldMap">
   8:         <MappedFields>
   9:           <MappedField LeftName="Headline" RightName="System.Title" MapFromSide="Left" valueMap="" />
  10:           <MappedField LeftName="Headline" RightName="System.Title" MapFromSide="Right" valueMap="" />
  11:           <MappedField LeftName="State" RightName="System.State" MapFromSide="Left" valueMap="StateMapCQ2TFS" />
  12:           <MappedField LeftName="State" RightName="System.State" MapFromSide="Right" valueMap="StateMapTFS2CQ" />
  13:           <MappedField LeftName="Description" RightName="System.Description" MapFromSide="Left" valueMap="" />
  14:           <MappedField LeftName="Description" RightName="System.Description" MapFromSide="Right" valueMap="" />
  15:         </MappedFields>
  16:       </FieldMap>
  17:     </FieldMaps>
  18:     <ValueMaps>
  19:       <ValueMap name="StateMapCQ2TFS">
  20:         <Value RightValue="Active" LeftValue="Assigned" />
  21:         <Value RightValue="Active" LeftValue="Duplicate" />
  22:         <Value RightValue="Active" LeftValue="Opened" />
  23:         <Value RightValue="Active" LeftValue="Submitted" />
  24:         <Value RightValue="Resolved" LeftValue="Postponed" />
  25:         <Value RightValue="Resolved" LeftValue="Resolved" />
  26:         <Value RightValue="Closed" LeftValue="Closed" />
  27:       </ValueMap>
  28:       <ValueMap name="StateMapTFS2CQ">
  29:         <Value RightValue="Active" LeftValue="Assigned" />
  30:         <Value RightValue="Resolved" LeftValue="Resolved" />
  31:         <Value RightValue="Closed" LeftValue="Closed" />
  32:       </ValueMap>
  33:
  34:   </WITSessionCustomSetting>
  35: </SettingXml>
  36: <SettingXmlSchema />

I have taken as a reference the examples raised by willy Peter shaub in this post, for the complete migration to TFS2010TFS2008 then consult with the Brunoelements.

Greetings @ Home

The Bruno

   

One thought on “[TFSINTEGRATION] HowTo: Define custom mappings for the migration between TFS2008 and TFS2010

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 )

Google photo

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

Twitter picture

You are commenting using your Twitter 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.