VSTS Build & Release to Azure DevOps Pipelines tasks

Out with the old, in with the new! With the rename of Visual Studio Team Services Build and Release Management to Azure DevOps Pipelines all of the underlying libraries are being renamed too.

In order to stay up to date and receive the latest updates you'll need to make a few small changes to your existing build tasks:

Update your vss-extension.json

The categories in the Marketplace have changed to reflect the new names of the Hubs in Azure DevOps.Your tasks must be updated to reflect this change:

  "description": "Snyk continuously finds and fixes vulnerabilities in your dependencies.",
  "categories": [
-    "Build and release"
+    "Azure Pipelines"
  ],

Change the category of your extension in your extension manifest from it's old name to the new names:Azure Repos, Azure Boards, Azure Pipelines, Azure Test Plans, and Azure Artifacts.

Remove your dependency on vsts-task-lib

The vsts-task-lib has been renamed to azure-pipelines-task-lib and you'll need to update your package.json to pickup this new library:

npm uninstall vsts-task-lib --save
npm install azure-pipelines-task-lib@latest --save

Or manually update your package.json:

  "dependencies": {
-    "vsts-task-lib": "^2.3.0"
+    "azure-pipelines-task-lib": "^2.7.5"
  },

Update your typescript files to import the new library

And now that you have a new module you depend on, you'll need to import it in your typescript files:

- import * as tl from "vsts-task-lib/task";
- import * as tr from "vsts-task-lib/toolrunner";
+ import * as tl from "azure-pipelines-task-lib/task";
+ import * as tr from "azure-pipelines-task-lib/toolrunner";

After changing your import / require statements, all the existing functions should remain operational, unless you're upgrading from a very old version of the vsts-task-lib.

Update to the latest version of tfx-cli

If you're using the old version of tfx-cli it will balk at the new extension categories. The easiest way to fix that is to update to the latest version of tfx-cli, but if you're stuck on an older version for whatever reason, suppress local validation to get your extension published:

tfx extension publish --bypass-validation

And if you're using the Azure DevOps Tasks for Extensions you'll have to make sure you're on 1.2.8 or you'll have to enable this feature:

Use Bypass local validation if you're on an older version of the Azure DevOps Extension Tasks.

I've just upgraded my first task, the Snyk Task, and you can see all the changes here. I've done a bit of refactoring in this release as well and the old name has mostly been eradicated. The only thing I'll be stuck with is the Extension ID, all of my extensions have vsts in their ID and there is no way to get rid of that without breaking all my users.

Leave a comment.