Creating a Private Repository for Visual Studio Extensions with Docker
Sometimes, you just don't need everyone to see. Take a look at this brief tutorial that can help you create your own private Visual Studio ''Marketplace.''
Join the DZone community and get the full member experience.
Join For FreeExtensions and project templates nowadays are very common; we use extensions every day in Visual Studio.
Extensions and templates are hosted in VisualStudio’s MarketPlace and are public, in some cases, especially when we talk about project templates, where we can have intellectual property of the company or project. We need a private “MarketPlace,” and I will demonstrate how to create one with Docker:
First of all, you need to have Docker installed and running.
Let’s use NGINXcontainer to host our package:
docker run --name docker-nginx -p 8080:80 -d nginx
With this command, we will map port 8080 to the host to access NGINX.
Great! We already have the web server up and running. We now create the XML file that we call gallery.xml where the settings are as shown below:
<?xml version="1.0" encoding="utf-8" ?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title type="text">Component Title</title>
<id>591c105e-bd42-4008-bcef-d822c1bd7607</id>
<updated>2018-03-20T00:00:00Z</updated>
<entry>
<id>22496D52-F1E2-48DD-970F-93FA3D84F793</id>
<title type="text">Component Name</title>
<summary type="text">Description...</summary>
<published>2018-03-21T00:00:00Z</published>
<updated>2018-03-21T00:00:00Z</updated>
<author>
<name>Thiago :)</name>
</author>
<link rel="alternate" type="text/html" href="http://www.site.com"/>
<link rel="releasenotes" type="text/html" href="http://www.site.com"/>
<link rel="icon" type="text" href="image.png"/>
<link rel="previewimage" type="text" href="image.png"/>
<category term="Tools" />
<content type="application/octet-stream" src="Extension.vsix" />
<Vsix xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://schemas.microsoft.com/developer/vsx-syndication-schema/2010">
<Id>22496D52-F1E2-48DD-970F-93FA3D84F793</Id>
<Version>1.0</Version>
</Vsix>
</entry>
</feed>
A very important detail is the <id>
field and Guid must match exactly with the Guid of your Vsix package. If you do not know the Guid of your component, take a look at this hint:
To get the vsixid of a .vsix file, make a copy of the .vsix file and rename it to .zip. You can then open it and find an extension.vsixmanifest file inside. This is an XML file, and if you open it you will see an
<Identity Id="guid"... />
node.
Then copy your files into the container, navigate to the folder and type the following commands:
docker cp ext.vsix docker-nginx:/usr/share/nginx/html/ext.vsix
docker cp gallery.xml docker-nginx:/usr/share/nginx/html/gallery.xml
Check to see if you can access the XML file:
If you receive the result as shown above your repository is ready. Now just open your Visual Studio and configure it in Tools -> Options and then Environment -> Extensions and Updates:
After that go to Tools -> Extensions and Updates and your RepoPrivado will be available with your package ready for Download and Updates.
Now just publish your container to your server and your extension repository is ready.
Opinions expressed by DZone contributors are their own.
Comments