— New online course!  Getting Started with Azure DevOps — Special launch price 50% off —

TfsUtility: Import / Export Build & Release Definitions + more

by

I’ve been doing a bunch of work with the new version of Build and Release Management in Team Foundation Server 2015 (TFS2015) lately and discovered a handful of things that I wish that I could do from the command line.  Specifically, I wished that I could import and export my build definitions and release definitions.  Well, a couple years back, I released a set of command line utilities for Team Foundation Server so I decided to do an upgrade and add some new features.

The new features:

  • List Build Definitions
  • Export Build Definition to JSON
  • Import Build Definition from JSON to TFS
  • List Release Definitions
  • Export Release Definition to JSON
  • Import Release Definition JSON to TFS

With these new features you can export and share your build and release definitions between TFS Team Projects and servers.

The utility still has the original features, too:

  • List Team Projects
  • List Work Item Queries
  • List Work Item Query Folders
  • Export Work Item Query
  • Import Work Item Query
  • List Iterations (aka. List Sprints)
  • Add Iteration (aka. Add a Sprint)

Here’s a link to download the utility.  Here’s a link to download the source code.

-Ben

 

— Need help with your TFS Builds?  Not sure where to start with TFS Release Management?  Want to get good at DevOps?  We can help.  Drop us a line at info@benday.com


6 Responses to "TfsUtility: Import / Export Build & Release Definitions + more"
  1. Hi. The tool is very useful. It has a small bug – it does not set the proper “Default agent queue” from the imported file. The code always sets the Default (Id = 1). I tried to modify the UploadUpdatedBuildDefinition() method, but I still have Default queue.

    The code I added was:

    BuildDefinitionForUploadModified.BuildQueueId q = new BuildDefinitionForUploadModified.BuildQueueId();
    //q.Id = “2”;
    q.Id = buildDefinitionDataAsJson[“queue”][“id”].ToString();
    definition.Queue = q;

    inside the using (WebClient client = new WebClient()) part of the script.

    What else could I try? I’m testing on TFS 2015

  2. Hi BartekR — I don’t know what the right answer would be for this. I think that you’d need to code something to enumerate the available queues and then prompt the user (or add another command line arg) for the correct queue.

  3. Thanks. It’s a good idea. For now I hardcoded the value (2) and it works. But I’m still working on it.

  4. When using this tool to fetch list of release definitions it throw error. I am using following in command line

    tfsutility listreleasedefinitions /collection:https://tfs2017./tfs/ColA /project:AND

    this is the error I am getting

    System.Net.WebException: The remote server returned an error: (404) Not Found.
    at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request)
    at System.Net.WebClient.DownloadString(Uri address)
    at System.Net.WebClient.DownloadString(String address)
    at Benday.TfsUtility.ReleaseDefinitionListCommand.GetResult()
    at Benday.TfsUtility.ReleaseDefinitionListCommand.Run()
    at Benday.TfsUtility.Program.Main(String[] args)

    Command is working good for list build definition. Please suggest if I need to make any change.

Leave a Reply

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

%d bloggers like this: