Publish from the command line

You can use the TFS Cross Platform Command Line Interface (tfx-cli) to publish your extension to the Visual Studio Marketplace.

See the overview of publish, install, and share for additional details.

Before you begin

Before you begin, you need to get the TFX CLI from Node Package Manager and generate a personal access token. Also, if you have not done so, you need to set up a Publisher in the Gallery.

Acquire the TFS Cross Platform Command Line Interface

  1. If you don't have it, download and install NodeJS. During Setup, ensure that you leave Add to PATH chosen.

  2. Open a Command Prompt and type 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 personal access token

  1. Sign in to your organization ({organization}).

  2. From your home page, open your profile. Go to your security details.

    Go to Azure DevOps Services home, open your profile, go to Security
  3. Under Security, go to Personal access tokens, then choose Add.

    Add personal access token
  4. Add a description for your token, then select an expiration timeframe for your token.

  5. In the Accounts list, select All accessible accounts. This is required because the Visual Studio Marketplace publishing APIs work outside the context of an organization.

  6. Select the Marketplace (publish) scope. This limits the token to only being able to publish extensions to the Marketplace.

    Marketplace scope
  7. Finish creating your token.

  8. Copy your generated personal access token. Make sure to keep it secret.

    Copy personal access token

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 TFS Cross Platform Command Line Interface, simply run the following command, replacing each argument with the necessary value.

tfx extension publisher create


The 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 the TFX CLI is installed and you have your personal access token, you can use the tool to package and publish your extension.

  1. Open a command prompt to the root directory of your extension.
  2. Run the tfx extension publish command passing in any necessary parameters. Run tfx extension publish --help to 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:  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. Note that 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\
 - Publishing: success
 - Sharing: shared with fabrikam