Using tcm to export and import field mappings

 

To import and export the XML file that maps to the type provided, use the following tcm command:

  • tcm fieldmapping /import

  • tcm fieldmapping /export

Note

The fieldmapping option is only available with Visual Studio 2012.2 or later.

Syntax

tcm fieldmapping /import /type: typeofmapping /mappingfile: path /collection:CollectionURL /teamproject:project [/login:username,[password]]  
tcm fieldmapping /export /type: typeofmapping /mappingfile: path /collection:CollectionURL /teamproject:project [/login:username,[password]]  

Parameters

Parameter Description
/type: typeofmappingfile Specifies the type for which export/import needs to be done.

Types: resolutiontype, bug, failuretype.

Expected value: resolutiontype.
/mappingfile: path Specifies full path, including file name for export/import.

For import option, verify that the file exists and for export option, make sure the file does not exist.
/collection:CollectionURL Specifies the URI of the team project collection. The format for the URI is as follows: http://ServerName:Port/VirtualDirectoryName/CollectionName

If no virtual directory is used, then the format for the URI is as follows:

 http://ServerName:Port/CollectionName
/teamproject:project The name of the team project that contains the test plan that you want to import your automated tests into.
/login:username,[password] Optional. Specifies the name and password of a user who is logged on to the application-tier server for Team Foundation Server and who has permissions to run the command. You would use this option if your Windows credentials do not have the appropriate permissions, or you are using basic authentication, or you are not connected to a domain.

To login to Visual Studio Team Services, you will also need to use /allowalternatecredentials listed below.
/allowalternatecredentials This flag must be specified in addition to the /login parameter when connecting to Visual Studio Team Services. (This flag is only available if you have Visual Studio 2013 Update 4 or greater.)

Examples

Import and export XML fieldmapping file

The following examples assume that you have started a Visual Studio command prompt.

To do this, choose Start, point to All Programs, point to Microsoft Visual Studio 2012, point to Visual Studio Tools, and then choose Developer Command Prompt.

The command prompt opens to the folder: <drive>:\Program Files\Microsoft Visual Studio 11.0\VC

Change the directory to the folder that contains the assembly built from your test project.

The following command imports fieldmapping into the DinnerNow team project from a specified XML file:

tcm fieldmapping /import /type:resolutiontype /mappingfile:<drive>\dir\sudir\filetoimport.xml /collection:https://<Team Foundation Server Name>:8080/tfs/<team project collection name>  
/teamproject:DinnerNow  

The following command exports fieldmapping from the DinnerNow team project:

tcm fieldmapping /export /type: resolutiontype /mappingfile:<drive>\dir\sudir\filetoexport.xml /collection:https://<Team Foundation Server Name>:8080/tfs/<team project collection name>  
/teamproject:DinnerNow  

See Also

Using TCM from the command line