Create a private gallery for self-hosted Visual Studio extensions
Most Visual Studio extension authors publish their extensions to the public Marketplace to allow everyone to install them and benefit from the large and open ecosystem. However, some companies create extensions for internal use only. A private gallery allows them to distribute the extensions easily with the same auto-update capabilities enjoyed by any public Marketplace extension. And now, we’ve streamlined the process even more so that you can easily create a private gallery for your team or organization.
Visual Studio 2010 introduced support for private galleries, but few used them due to lacking samples and tooling. A lot has changed since then and the private gallery support has seen several updates to support extension packs and other more recent features.
The anatomy of a private gallery
A private gallery is an ATOM feed XML File that contains meta data about the extensions. Registering the gallery with Visual Studio can be done either by the user manually under Tools -> Options or by an extension using a custom .pkgdef file (example).
The ATOM feed can be located on a web server, file system or file share. After registering the gallery, a new category appears under the Online tab in the Extension Manager dialog as shown in the first screenshot above.
Create the ATOM feed
The open source tool Private Gallery Creator makes it straightforward to create the ATOM feed. Download the executable and run it in a folder containing the VSIX files you wish to include in the feed. The tool analyzes the VSIX files and extracts the metadata needed to produce a file called feed.xml in the same folder.
You could also set up a CI/CD pipeline that automatically executes the tool to update the feed. In addition, the tool has a “watch” feature to automatically produce a new feed any time a VSIX file is added or modified in the same folder.
Set it up in only four steps
Here’s a recap of how to set up a private gallery:
- Put your .vsix files into an empty folder accessible to all consumers of the gallery
- Download PrivateGalleryCreator.exe executable into the same folder
- Double-click PrivateGalleryCreator.exe to produce the feed.xml file
- Register the feed in Visual Studio manually or from an extension’s .pkgdef file
You can learn more about private galleries from the documentation and by checking the Private Gallery Creator project on GitHub. There are a few public offerings for hosted private galleries such as MyGet and Open VSIX Gallery that may be worth looking into as well.
We’d love to hear about how you use private galleries today or why you don’t use them, so please sound off in the comments below.
Great to see this being made more accessible, I remember doing this nearly 7 years ago for my current work place and had to reverse engineer the official feeds to work out how to do it.
I’ve been using Private Gallery Creator for the last year or so in both VS 2017 & 2019