JWP
JWP

Reputation: 6963

Can one get new VSIX notifcations using just file paths?

New VSIX release notifications are seen within Visual Studio automatically based on Atom Feeds, which are most often hosted in a Web API, is it possible to just build the project and include the Atom XML markup in the build folder and use that content for Visual Studio to notify of new extensions (on that computer)?

I ask this as a developer of VSIX plug-ins who currently does not have access to a web server in corporate environment. I can create a Web API running on my local machine for the Atom feed, but before I do that I was wondering if I even need to do that?

Please advise.

Upvotes: 1

Views: 115

Answers (1)

JWP
JWP

Reputation: 6963

You can host VSIX extensions using just the file system.

Here's the technique:

Create the Atom Feed first, name it Atom.xml

You can, put it into the same project where the extension is developed. This makes it easy to update it when changes are made.

<?xml version="1.0" encoding="utf-8" ?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title type="text" />
  <id>bcecded5-97c8-4d24-96f1-6347778</id>
  <updated>2016-09-30T14:08:00-07:00</updated>
  <entry>
    <id>PluginName.Author Name.3d71e2fe-5771-4bb6-837c-192a7cce378e</id>
    <title type="text">PluginName</title>
    <summary type="text">Advertisement on what this plug in does</summary>
    <published>2016-09-30T14:08:00-07:00</published>
    <updated>2016-09-30T14:08:00-07:00</updated>
    <author>
      <name>Author Name</name>
    </author>

    <content type="application/octet-stream" src="MagenicS2.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>PluginName.Author Name.3d71e2fe-5771-4bb6-837c-192a7cce378e</Id>
      <Version>1.7</Version>
      <References />
      <Rating xsi:nil="true" />
      <RatingCount xsi:nil="true" />
      <DownloadCount xsi:nil="true" />
    </Vsix>
  </entry>
</feed>

The feed container attributes are:

  1. Id is not majorly important other than to be unique. It's just a string of uniqueness, does not have to conform to GUID etc.
  2. Updated does not signal VS to show a new version is available, that's done in the Entry version.

The Entry Section

The attributes are the same as are configured in the VSIXManifest file: ID-This is the Product ID as found in the VSIXManifest of the plug in. Version-If this value changes Visual Studio will advertise a new version is ready to be installed.

Determine where the file share will be hosted

OneDrive works nicely and gives you control over who gets the plug-in.

C:\Users\UserName\OneDrive\Publish\PluginName

Post-Build Event Command Line

In the VSIX project go to Properties/Build Events and put this into the Post-Build Event command line text area:

xcopy  /Y /Q "$(TargetDir)PluginName.vsix"  "C:\Users\UserName\OneDrive\Publish\PluginName\PluginName.vsix"
xcopy /Y /Q  "$(TargetDir)atom.xml"  "C:\Users\UserName\OneDrive\Publish\PluginName\atom.xml"

This allows the build to publish the content and will publish both Debug and Release versions each time you build.

The Publish Folder Content

This folder needs just two items:

  • atom.xml
  • PlugInName.VSIX

How to Install

The users will need to click on VSIX file to get the first install, from there on, Visual Studio will automatically look for updates once the configuration is complete.

How to Configure VS to look for updates

In VS go to Tools/Extensions and Updates then click on "Change you Extensions and Update settings".

Click the add button and put in a name:

  • Private Gallery
  • file:///C:/Users/UserName/OneDrive/Publish/PluginName/atom.xml

Testing Updates

  • The plug in must be installed and the VS configuration set to proper publish location.
    • Change the release of the add in in the VSIX mainfest (the assembly version) and also make the same version change to the atom.xml file entry version attribute.
    • In VS go to Tools/Extensions and Updates click on Private Gallery and you should see a new update.
    • Click on the update and VS should install the new version without any issues.

Upvotes: 2

Related Questions