Using Private Extension Galleries in Visual Studio 2012

 

Updated January 13th 2013:  Added note about ASP.NET MVC 4.0 prerequirement

Note: The installer and the complete source code is available over at CodePlex at the following location: http://inmetavsgallery.codeplex.com

 

Extensions and addins are everywhere in the Visual Studio ALM ecosystem! Microsoft releases new cool features in the form of extensions and the list of 3rd party extensions that plug into Visual Studio just keeps growing. One of the nice things about the VSIX extensions is how they are deployed. Microsoft hosts a public Visual Studio Gallery where you can upload extensions and make them available to the rest of the community. Visual Studio checks for updates to the installed extensions when you start Visual Studio, and installing/updating the extensions is fast since it is only a matter of extracting the files within the VSIX package to the local extension folder.

But for custom, enterprise-specific extensions, you don’t want to publish them online to the whole world, but you still want an easy way to distribute them to your developers and partners. This is where Private Extension Galleries come into play. In Visual Studio 2012, it is now possible to add custom extensions galleries that can point to any URL, as long as that URL returns the expected content of course (see below).Registering a new gallery in Visual Studio is easy, but there is very little documentation on how to actually host the gallery.

Visual Studio galleries uses Atom Feed XML as the protocol for delivering new and updated versions of the extensions. This MSDN page describes how to create a static XML file that returns the information about your extensions. This approach works, but require manual updates of that file every time you want to deploy an update of the extension.

Wouldn’t it be nice with a web service that takes care of this for you, that just lets you drop a new version of your VSIX file and have it automatically detect the new version and produce the correct Atom Feed XML?

Well search no more, this is exactly what the Inmeta Visual Studio Gallery Service does for you 🙂

image

Here you can see that in addition to the standard Online galleries there is an Inmeta Gallery that contains two extensions (our WIX templates and our custom TFS Checkin Policies). These can be installed/updated i the same way as extensions from the public Visual Studio Gallery.

Installing the Service

  1. The service uses ASP.NET MVC 4.0, so make sure that you have this installed on your web server.
  2. Download the installer (Inmeta.VSGalleryService.Install.msi) for the service and run it.
    The installation is straight forward, just select web site, application pool and (optional) a virtual directory where you want to install the service.

    image 

    Note: If you want to run it in the web site root, just leave the application name blank

  3. Press Next and finish the installer.
  4. Open web.config in a text editor and locate the the <applicationSettings> element
  5. Edit the following setting values:
    • FeedTitle
      This is the name that is shown if you browse to the service using a browser. Not used by Visual Studio
    • BaseURI
      When Visual Studio downloads the extension, it will be given this URI + the name of the extension that you selected. This value should be on the following format:
      http://SERVER/[VDIR]/gallery/extension/

    • VSIXAbsolutePath
      This is the path where you will deploy your extensions. This can be a local folder or a remote share. You just need to make sure that the application pool identity account has read permissions in this folder
  6. Save web.config to finish the installation
  7. Open a browser and enter the URL to the service. It should show an empty Feed page:

    image 

Adding the Private Gallery in Visual Studio 2012
Now you need to add the gallery in Visual Studio. This is very easy and is done as follows:

  1. Go to Tools –> Options and select Environment –> Extensions and Updates

  2. Press Add to add a new gallery
  3. Enter a descriptive name, and add the URL that points to the web site/virtual directory where you installed the service in the previous step

     image

  4. Press OK to save the settings.

Deploying an Extension
This one is easy: Just drop the file in the designated folder! 🙂  If it is a new version of an existing extension, the developers will be notified in the same way as for extensions from the public Visual Studio gallery:

image

I hope that you will find this sever useful, please contact me if you have questions or suggestions for improvements!

0 thoughts on “Using Private Extension Galleries in Visual Studio 2012”

  1. Originally posted on: http://geekswithblogs.net/jakob/archive/2012/11/07/using-private-extension-galleries-in-visual-studio-2012.aspx#622608

    Hello.
    Great idea.
    Unfortunately I could’t get it working. I made changes in configuration as described:

    <applicationSettings>
    <Inmeta.VSGalleryService.Properties.Settings>
    <setting name=”FeedTitle” serializeAs=”String”>
    <value>My VS Gallery</value>
    </setting>
    <setting name=”BaseURI” serializeAs=”String”>
    <value>http://localhost/vsgallery</value&gt;
    </setting>
    <setting name=”VSIXAbsolutePath” serializeAs=”String”>
    <value>C:VSIXRepo</value>
    </setting>
    </Inmeta.VSGalleryService.Properties.Settings>
    </applicationSettings>

    But when I access “http://localhost/vsgallery” I get emopty page. Folder ‘C:VSIXRepo’ contains some *.vsix.
    What can be wrong?

  2. Originally posted on: http://geekswithblogs.net/jakob/archive/2012/11/07/using-private-extension-galleries-in-visual-studio-2012.aspx#634958

    I’d really like to use this great tool. But I’m having Problems with either 404 errors (path to gallery/Extension-Provlem I guess) when using the server out of box. Or if I modify the method BuildUri in the GalleryController to point to the correct location all I get is a 406 error. I then changed all GetStream calls to use FileAccess.Read in the GalleryController and also gave the Application Pool User Full Control permissions on both the website and the vsix folder location (for testing pruposes only). Unfortunatly that didn’t change a thing…
    I’m hosting the gallery server on a IIS8.5 (Server2012 R2) and I’m using a dedicated application pool and website, so the gallery server is located in the root.
    Any Ideas?

    Best regards
    Sascha

  3. Originally posted on: http://geekswithblogs.net/jakob/archive/2012/11/07/using-private-extension-galleries-in-visual-studio-2012.aspx#634959

    @Sascha: May I recommend you to look at the new version of the Inmeta Visual Studio Gallery that I just published? Among a lot of things, it uses a SQL database for storing extensions so you don’t have to struggle with the file permissions etc.

    I blogged about it here:
    http://geekswithblogs.net/jakob/archive/2013/12/26/inmeta-visual-studio-extension-gallery-ndash-version-2.0.aspx

    The solution is deployed on the CodePlex site

  4. Originally posted on: http://geekswithblogs.net/jakob/archive/2012/11/07/using-private-extension-galleries-in-visual-studio-2012.aspx#634961

    Thanks for the fast reply! Very much appreciated.
    I do not want to go to SQL Server based version at the moment because we only host a few files there.
    By accident I just got it working. I had the vsix files located in C:VsixExtensions and that just does not work.
    Now I created the directory strurcture like this C:VsixExtensionsgalleryExtension and moved the files down there.
    My web.config looks like this:

    <setting name="FeedTitle" serializeAs="String">
    <value>My Visual Studio Extensions</value>
    </setting>
    <setting name="BaseURI" serializeAs="String">
    <value>http://vsix/gallery/Extension/</value>
    </setting>
    <setting name="VSIXAbsolutePath" serializeAs="String">
    <value>c:VsixExtensionsgalleryExtension</value>
    </setting>
    </Inmeta.VSGalleryService.Properties.Settings>

    This way it works like a charm!

    Thanx again for sharing!
    Sascha

    1. Worked for me too! I was “fighting” with the Error 406 – Not Acceptable.

      The solution is that: Create the same PATH. As follow>

      Put your files under:

      C:\…\your-web-site\Gallery\Extension

      Ps: you can create free subfolders under “Gallery\Extension” – Visual Studio will show them on the screen.

      Tks Jakob and Sascha!

Leave a Reply

Your email address will not be published.