vsce
Package, publish, and manage VS Code extensions
TLDR
List all the extensions created by a publisher
Publish an extension as major, minor or patch version
Unpublish an extension
Package the current working directory as a .vsix file
Show the metadata associated with an extension
SYNOPSIS
vsce <command> [options]
Common commands:
vsce package [options] Packages the current extension into a .vsix file.
vsce publish [version] [options] Publishes the current extension to the Marketplace.
vsce login Manages publisher login with a Personal Access Token.
vsce unpublish Unpublishes an extension from the Marketplace.
vsce ls-publishers Lists all publishers for your account.
PARAMETERS
--help
Displays help information for a command or for vsce itself.
--version
Shows the current version of the vsce tool.
--yarn
Forces the use of Yarn for dependency installation instead of npm during packaging/publishing.
--no-install
Skips dependency installation (npm install/yarn install) during packaging/publishing.
--dry-run
Performs a 'dry run' of the publish command without actually publishing to the Marketplace. Useful for validation checks.
--baseContentUrl
Specifies a base URL for content links within the extension package, like images in README.
--baseImagesUrl
Specifies a base URL for images referenced within the extension package.
--pat
Provides a Personal Access Token (PAT) directly for authentication, overriding stored credentials (primarily for publish and login).
DESCRIPTION
vsce is the official command-line tool developed by Microsoft for managing Visual Studio Code extensions. It empowers developers to easily package their extensions into a VSIX file, which is the distributable format for VS Code extensions, and then publish them directly to the Visual Studio Code Marketplace. This tool handles the complexities of preparing an extension for distribution, including validation checks, versioning, and secure authentication with the marketplace using Personal Access Tokens (PATs). Beyond packaging and publishing, vsce also provides commands to list publishers, log in/out from the marketplace, and unpublish existing extensions. It is an indispensable utility for any VS Code extension developer aiming to share their creations with the wider VS Code community.
CAVEATS
Node.js Requirement: vsce requires Node.js and a package manager (npm or Yarn) to be installed on the system.
Personal Access Token (PAT): Publishing extensions to the Visual Studio Code Marketplace necessitates a Personal Access Token generated from Azure DevOps with appropriate scopes.
Package.json Metadata: The tool heavily relies on a well-formed package.json file in the extension's root directory for metadata, versioning, and dependency management.
Marketplace Validation Rules: vsce enforces strict validation rules set by the Marketplace, which can lead to failures if the extension package does not meet requirements (e.g., missing README.md, invalid icon format, uncommited changes).
Git Integration: For proper versioning and repository linking, the extension project is expected to be a Git repository, and Git tags can influence publishing behavior and version incrementing.
INSTALLATION
vsce is distributed as an npm package and can be installed globally using npm:
npm install -g vsce
Ensure Node.js and npm are installed on your system before attempting installation.
AUTHENTICATION FOR PUBLISHING
To publish extensions, vsce requires a Personal Access Token (PAT) with 'Marketplace (Publish)' scope from Azure DevOps. Once generated, you authenticate using the vsce login command, which securely stores the token for future publishing operations. Alternatively, the PAT can be passed directly via the --pat option for one-time use or CI/CD pipelines.
HISTORY
vsce emerged as an integral part of the Visual Studio Code ecosystem, developed by Microsoft to streamline the process of extension development and distribution. Its inception coincided with the growing popularity of VS Code and the need for a robust, official mechanism to bring extensions to the Marketplace. Since its initial release, vsce has undergone continuous development, adapting to new features in VS Code, changes in the Azure DevOps-backed Marketplace API, and evolving best practices for extension packaging. It quickly became the de-facto standard tool for VS Code extension authors, simplifying complex tasks like VSIX creation and secure publishing.