Publish from the command line
Azure DevOps Services | Azure DevOps Server 2020 | Azure DevOps Server 2019 | TFS 2018 - TFS 2017
You can use the Cross-platform CLI for Azure DevOps (tfx-cli) to publish your extension to the Visual Studio Marketplace.
For more information, see the overview of publish, install, and share.
Get the TFX CLI from Node Package Manager and generate a personal access token (PAT). Also, if you haven't already, set up a Publisher in the Gallery.
Acquire the Cross-platform CLI for Azure DevOps
If you don't have it, download and install NodeJS. During set up, ensure that you leave Add to PATH chosen.
Open a Command Prompt and enter
npm i -g tfx-cli.
If you already have the TFX CLI installed, you can update to the latest release by running
npm up -g tfx-cli.
Acquire a PAT
Sign in to your organization (
From your home page, open the user settings icon, and then select Profile.
Under Security, select Personal access tokens, and then select New Token.
Complete the form:
- Name your token
- Select All accessible organizations, which is the only value that works when publishing via CLI. If you select only one organization, it results in an error, even if the PAT is valid
- Select an expiration time frame for your token. This is required because the Visual Studio Marketplace publishing APIs work outside of the context of an organization
- Set the scope of access associated with this token. Be sure to select the Marketplace (publish) scope. This scope limits the token to only being able to publish extensions to the Marketplace.
- Select Create
Copy your generated personal access token. Make sure to keep it secret.
Create a publisher
If you haven't already created a publisher, you can do so using the command line tool.
To create a publisher using the Cross-platform CLI for Azure DevOps, run the following command, replacing each argument with the necessary value.
tfx extension publisher create
Publisher name must match the publisher property in your extension manifest.
C:\tfs-cli>tfx extension publisher create Copyright Microsoft Corporation > Publisher name: Fabrikam > Display name: Fabrikam, Inc. > Description: Fabrikam's main publisher === Completed operation: create publisher === - Name: Fabrikam - Display Name: Fabrikam, Inc. - Description: Fabrikam's main publisher
Publish from the command line
Once TFX CLI is installed and you have your PAT, you can use the tool to package and publish your extension.
- Open a command prompt to the root directory of your extension.
- Run the
tfx extension publishcommand passing in any necessary parameters. Run
tfx extension publish --helpto see all available options.
You may receive the following error when publishing if your extension has already been published:
Failed Request: Internal Server Error(500) - Version number must increase each time an extension is published. Extension: fabrikam.my-extension Current version: 0.1.9 Updated version: 0.1.9
You can add the
--rev-version command line option to automatically increment the patch version of your extension.
This also saves the new version to your manifest.
C:\vso-team-calendar>tfx extension publish --share-with fabrikam --rev-version Copyright Microsoft Corporation > Personal access token: Checking if this extension is already published It is, update the extension Waiting for server to validate extension package... Sharing extension with fabrikam. === Completed operation: publish extension === - Packaging: C:\vso-team-calendar\fabrikam.team-calendar-0.2.6.vsix - Publishing: success - Sharing: shared with fabrikam