DEV Community

Cover image for 🌎 Publishing Your Extensions to Visual Studio Marketplace
Alvin James Bellero
Alvin James Bellero

Posted on • Edited on

🌎 Publishing Your Extensions to Visual Studio Marketplace

In today's world, technology is evolving at a fast pace, and developers are constantly looking for ways to improve their productivity and streamline their workflow. One of the tools that has gained immense popularity in recent years is Visual Studio Code (VSCode). With its robust set of features and extensive library of extensions, VSCode has become the go-to code editor for many developers.

πŸ’‘ But did you know that you can also create your own extensions for VSCode and share it with the community? If you missed my last post about "Creating Your First VSCode Extension Theme", you can check that out here.

In this article, we will explore the process of publishing your own extensions to the VSCode Marketplace. Whether you're looking to solve a specific problem, add new features, or just share your work with others, publishing extensions to the marketplace is an excellent way to contribute to the developer community and improve your own development experience. πŸ™Œ πŸ˜‰


Seems like a winning combo to me


✨ Setup You Microsoft Azure DevOps Account

As you've probably know, VSCode is created and maintained by Microsoft. With that, we now have a single login for Azure Cloud Services and VSCode Extensions.

Head on to https://dev.azure.com/ website and create an account. You can opt to sign in with your Github account or just register with your personal email.

Once you've successfully registered, you will be redirected to your Azure DevOps Dashboard page under your created Organization name.

Azure DevOps Dashboard


πŸͺ™ Create your Personal Access Token (PAT)

This will be used as your authentication in publishing your extensions in the marketplace.

Click on the User Profile settings icon beside your avatar and choose Personal access tokens.

Navigating to Personal Access Tokens in Azure


  1. Click New Token to create your Token.
  2. Add your Token Name
  3. Under Organization, select All accessible organizations
  4. For Expiration, select Custom defined which will default to 1 year from now as the maximum expiration time
  5. Under Scopes, make sure Custom defined is selected.
  6. At the bottom, click Show all scopes and scroll down to Marketplace section
  7. Select the Manage option
  8. And lastly, click the blue Create button

Create Personal Access Token Modal

🚨 WARNING: Make sure you SAVE A COPY of your newly created access token (PAT) as Azure will not store it and you will not be able to see it again. And most importantly, don't share it to anyone! πŸ‘€ πŸ”

Are you still with me?


πŸ“ Create a Publisher

This will be your Publisher Name attached to your extension when it is available to the marketplace.

Navigate to: https://marketplace.visualstudio.com/manage and you should see a Create Publisher page. The only required fields here are the Name and ID of the publisher. The rest is optional.

If all goes well, you will be redirected to Manage Publishers & Extensions page. Keep that page open as we will be returning to it later.


πŸ“¦ Prepare Your Extension

Here are some steps to ensure your extension's smooth transition to marketplace.

  • Open your extension's folder in VSCode and go to your package.json file and make sure these properties are being set.


{
  "publisher": "<Your Publisher ID>",
  "repository": {
    "type": "git",
    "url": "<Your repository URL>"
  },
  "keywords": ["<Keyword 1>", "<Keyword 2>"]
}


Enter fullscreen mode Exit fullscreen mode

πŸ’‘ NOTE: Make sure your LICENSE file is existing on your ROOT repository as VSCode will check this during packaging / publishing.


πŸš€ Package and Publish it!

Once your extension is ready to go, you can package and publish it by using the terminal only.

  • Open the integrated terminal in VSCode and install their extension plugin by running:


npm install -g vsce


Enter fullscreen mode Exit fullscreen mode
  • Login to your publisher's account using vsce:


vsce login <You Publisher ID>


Enter fullscreen mode Exit fullscreen mode

πŸ” You will then be prompted to input your Personal Access Token (PAT). Copy and paste it there and tap Enter key.

  • Next, you can build a package of your theme by running: ```shell

vsce package

> :bulb: The plugin will automatically create a `.vsix` file in your extension's root directory indicating the package version on the filename. Make sure also **NOT** to check in this file to your repository.

- To publish it to marketplace, run:
```shell


vsce publish


Enter fullscreen mode Exit fullscreen mode
  • To verify the status of your deployment, navigate to your Manage Publishers & Extensions page and there you can see your extension's in "Verifying" status.

πŸ’‘ This may take a while and as soon as this process is complete, you can now see your extension's version and a green check mark before it!


🚧 Updating your Extension

For version updates, make sure you have a clean GIT working directory before publishing a PATCH, MINOR and MAJOR update.



vsce publish <patch|minor|major>


Enter fullscreen mode Exit fullscreen mode

The plugin will automatically handle the semantic versioning so you won't have to manually do it by yourself.

πŸ’‘ TIP: Run vsce package every time you publish a new update πŸ˜‰


πŸŽ‰ Congratulations!

And there you have it! Your extension is now available to the community for installation! Share it to your social media and friends! ❀️

Ricky and Morty - Good Job!

Top comments (0)