Introduction
A .vsix file packages an extension for
Visual Studio Code or for
Visual Studio. A VS Code extension
may add commands, languages, themes and so on. A Visual Studio extension may add VS
Packages, MEF components, templates and more.
Both kinds of file are ZIP archives that follow the
Open Packaging Conventions, and both have a manifest called
extension.vsixmanifest. What differs is what the manifest targets and
what the rest of the package holds. A VS Code package carries the extension in a
folder, normally extension/, with a package.json that says
what the extension does. A Visual Studio package has no package.json.
Structure
A VS Code package has these members. A file dropped on any page of this site opens
in the explorer, which shows the manifest, the tables from
package.json, the README and every member of the archive.
ZIP[Content_Types].xmlthe media type of each file extensionrequiredZIPextension.vsixmanifestthe package’s identity, targets and assets, in XMLrequiredZIPextension/package.jsonthe extension’s own manifestVS Code onlyZIPextension/…the extension’s code, icon, README and other filesvaries
extension/.To tell the two kinds apart, look at the manifest. A VS Code package targets
Microsoft.VisualStudio.Code in its InstallationTarget and
lists a Microsoft.VisualStudio.Code.Manifest asset that points to
package.json. A Visual Studio package targets a Visual Studio product
such as Microsoft.VisualStudio.Community, or uses the older
Vsix root element.
The rest of the format is described on these pages:
- Package layout – the ZIP archive and [Content_Types].xml
- extension.vsixmanifest – the manifest VS Code’s packager writes
- package.json – the fields of a VS Code extension’s manifest
- Contribution points – what an extension can add, point by point
- Activation events – when an extension starts
- Visual Studio packages – the manifest of an extension for the IDE
Not described
Known, not yet covered
- Viewer: a
contributespoint that VS Code’s contribution points reference does not list, or that a newer VS Code added, shows in an “Other contribution points” table as raw JSON with no meaning. The nested fields of the points that have tables (the settings schema of aconfigurationproperty beyond its type, default and description; the steps of a walkthrough; a debugger’sconfigurationAttributes) are summarised, not laid out field by field. - Reference: the packaging tools and files around a package are not described:
.vscodeignore, Open VSX, and for Visual Studio theVSIXInstaller,.pkgdeffiles and the contents of the assets a package lists (VS Packages, MEF components, templates).
Links
Software
- Visual Studio Code – Microsoft’s code editor, which installs .vsix files through Install from VSIX or
code --install-extension(Windows, macOS, Linux) - Visual Studio – Microsoft’s IDE, whose extension installer takes .vsix files (Windows)
- Visual Studio Marketplace – the store that hosts extensions for both editors
- Open VSX – an open registry of VS Code extensions
Developers
- vsce – the command-line tool that packages and publishes VS Code extensions (Node.js)
Reference
- Extension manifest – VS Code’s documentation of package.json
- Contribution points – VS Code’s list of what an extension can add
- VSIX extension schema 2.0 – Microsoft’s reference for extension.vsixmanifest
- What is a VSIX package? – Microsoft’s description of the package