乐闻世界logo
搜索文章和话题

How to publish VS Code extensions to marketplace?

2月18日 18:22

VS Code Extension Publishing and Marketplace Management

VS Code extension publishing is the process of publishing developed extensions to the VS Code marketplace for other users to use. Understanding the publishing process and marketplace management is crucial for extension developers.

Pre-publishing Preparation

Extension Validation Checklist

  1. Ensure extension functionality is complete and tested
  2. Write clear README.md documentation
  3. Prepare extension icon (128x128 pixels)
  4. Add appropriate tags and categories
  5. Verify package.json configuration

Key package.json Fields

json
{ "name": "my-extension", "displayName": "My Extension", "description": "A useful VS Code extension", "version": "1.0.0", "publisher": "your-publisher-name", "engines": { "vscode": "^1.60.0" }, "categories": [ "Other", "Snippets" ], "keywords": [ "utility", "productivity" ], "icon": "icon.png", "repository": { "type": "git", "url": "https://github.com/username/my-extension" }, "license": "MIT" }

Publisher Registration

Creating a Publisher Account

  1. Visit https://dev.azure.com/
  2. Sign in with Microsoft account
  3. Create new organization or use existing organization
  4. Create publisher in VS Code marketplace
  5. Get publisher name (used for publisher field in package.json)

Publisher Information

  • Publisher name: Globally unique, identifies extension publisher
  • Display name: Name shown in marketplace
  • Email: Used to receive notifications

Publishing Tool Installation

Installing vsce (VS Code Extension Manager)

bash
npm install -g @vscode/vsce

Verify Installation

bash
vsce --version

Packaging Extension

Basic Packaging Command

bash
vsce package

Specify Output Filename

bash
vsce package --out my-extension-1.0.0.vsix

Packaging Options

  • --baseContentUrl: Set base content URL
  • --baseImagesUrl: Set base images URL
  • --yarn: Use yarn instead of npm

Publishing Extension

First-time Publishing

bash
vsce publish

Publish Specific Version

bash
vsce publish minor vsce publish patch vsce publish 1.1.0

Publish to Pre-release Channel

bash
vsce publish --pre-release

Publish to Specific Target

bash
vsce publish --target win32-x64 vsce publish --target linux-x64,darwin-arm64

Version Management

Semantic Versioning

  • Major: Incompatible API changes
  • Minor: Backwards-compatible functionality additions
  • Patch: Backwards-compatible bug fixes

Update package.json

json
{ "version": "1.1.0" }

Extension Management

Updating Extension

  1. Modify code and package.json version number
  2. Re-package: vsce package
  3. Publish new version: vsce publish

Deprecating Extension

bash
vsce unpublish my-extension

Deleting Specific Version

bash
vsce delete my-extension 1.0.0

Marketplace Optimization

SEO Optimization

  • Use relevant keywords
  • Write attractive descriptions
  • Add appropriate tags
  • Provide clear screenshots and demos

User Review Management

  • Actively respond to user feedback
  • Promptly fix reported issues
  • Improve functionality based on user suggestions

Statistical Analysis

  • Visit VS Code marketplace statistics page
  • View download and installation counts
  • Analyze user behavior and feedback

Important Notes

  • Ensure extension complies with VS Code marketplace policies
  • Do not publish malicious or harmful extensions
  • Regularly update extension to maintain compatibility
  • Protect publisher account access tokens
  • Consider open-sourcing code to increase trust
标签:VSCode