How To Export And Import Build Definition In TFS

In this tutorial, I’ll explain how to export and import build definition in TFS2015. To export/Import your build definition we have to install a plug-in, as there is no built-in way to do that currently.

In this tutorial, I’ll explain how to export and import build definitions in TFS 2015.

To export/import our build definition, we have to install a plug-in, as there is no built-in way to do that currently.

STEP 1 - Download Extension

  1. Open TFS and click on "Browse for Extensions" on the extreme right side, as shown below.
    TFS
    TFS
  1. Download the extension from Visual Studio Marketplace.

    TFS

Using this extension, you are able to export your build definition and then import it in the same or another team project or even different collection/account.

On clicking "Install", it will ask to select the collection. Select Project collection and click on "Continue".

TFS

TFS

TFS

To Start 

Once you install the extension, go to Builds hub and right-click on any build definition. You will see two new menu items - Export and  Import.

TFS

Export build definition

Step 1

Right-click and click Export on the build definition you would like to export.

TFS

 

Step 2

You will be prompted to save the definition as a file.

TFS

Step 3

Save the file with JSON extension.

 

TFS

Import build definition

Step 1

Right-click on "All build definitions" or any existing build definition and click on Import.

TFS

Step 2

You will be prompted to upload a build definition file.

TFS

Step 3

You can either drag and drop a file or use the Browse button to select the file you want to import.

TFS

 

Step 4

Click Import. If the import is successful, you will have your build created with all your steps, variables, schedules, and other build definition parameters.

TFS

Constraints

  • Known issues on On-Prem TFS

    1. Export and Import menu items only appear on build definition context menu. If you are using on-prem TFS, then it won't appear on "All build definitions" context menu.

      For example, if you right-click on "All build definitions", the export and import options are not available as shown below.

      TFS

      BUT, on right-clicking on a particular build definition, we can see these options.

      TFS

    2. In case you don’t have any build definition, then in order to see those options, you will have to create a new temporary empty build definition.
  • If we are trying to import a build definition whose associated team project or repository does not exist in the collection/account we are trying to import, then we will get an error.