How to upgrade extensions to support Visual Studio 2019

Mads Kristensen

Recently, I’ve updated over 30 of my extensions to support Visual Studio 2019 (16.0). To make sure they work, I got my hands on a very early internal build of VS 2019 to test with (working on the Visual Studio team has its benefits). This upgrade process is one of the easiest I’ve ever experienced.

I wanted to share my steps with you to show just how easy it is so you’ll know what to do once Visual Studio 2019 is released.

Updates to .vsixmanifest

We need to make a couple of updates to the .vsixmanifest file. First, we must update the supported VS version range.

<InstallationTarget>

Here’s a version that support every major and minor versions of Visual Studio 14.0 (2015) and 15.0 (2017) all the way up to but not including version 16.0.

<Installation InstalledByMsi="false"> 
   <InstallationTarget Id="Microsoft.VisualStudio.Pro" Version="[14.0,16.0)" /> 
</Installation>

Simply change the upper bound of the version range from 16.0 to 17.0, like so:

<Installation InstalledByMsi="false">
   <InstallationTarget Id="Microsoft.VisualStudio.Pro" Version="[14.0,17.0)" />
</Installation>

<Prerequisite>

Next, update the version ranges in the <Prerequisite> elements. Here’s what it looked like before:

<Prerequisites> 
   <Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[15.0,16.0)" DisplayName="Visual Studio core editor" /> 
</Prerequisites>

We must update the version ranges to have the same upper bound as before, but in this case we can make the upper bound open ended, like so:

<Prerequisites> 
   <Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[15.0,)" DisplayName="Visual Studio core editor" /> 
</Prerequisites>

This means that the Prerequisite needs version 15.0 or newer.

If you have a dependency on Microsoft.VisualStudio.MPF then delete it. This dependency is a legacy one that hasn’t been needed since before Visual Studio 2010. It looks something like this:

<Dependencies>
   <Dependency Id="Microsoft.VisualStudio.MPF.14.0" DisplayName="Visual Studio MPF" d:Source="Installed" Version="[14.0]" />
</Dependencies>

See the updated .vsixmanifest files for Markdown Editor, Bundler & Minifier, and Image Optimizer.

Next Steps

Nothing. That’s it. You’re done.

Well, there is one thing that may affect your extension. Extensions that autoload a package has to do so in the background as stated in the blog post, Improving the responsiveness of critical scenarios by updating auto load behavior for extensions. You can also check out this walkthrough on how to update your extension to use the AsyncPackage if you haven’t already.

What about the references to Microsoft.VisualStudio.Shell and other such assemblies? As always with new version of Visual Studio, they are automatically being redirected to the 16.0 equivalent and there is backwards compatibility to ensure it will Just WorkTM.  And in my experience with the upgrade is that they in fact do just work.

I’m going to head back to adding VS 2019 support to the rest of my extensions. I’ve got about 40 left to go.

6 comments

Discussion is closed. Login to edit/delete existing comments.

  • Deepak Gupta 0

    This helped me.  Thanks!

  • Gordon deRouyan 0

    Hello,

    Some additions:
    manifest.json – at end of the file, I changed for the same modification in the extension.vsixmanifest
    “dependencies”:{“Microsoft.VisualStudio.Component.CoreEditor”:”[15.0,)”}}

    catalog.json – One third from beginning, same modification as manifest.json.
    “dependencies”:{“07fb5b16-f4be-4488-9a19-b4f36d2c05a6″:”1.7.0″,”Microsoft.VisualStudio.Component.CoreEditor”:”[15.0,)”}

    After completing all of the changes, the Object Exporter extension could be installed into Visual Studio 2019.

    Gordon de Rouyan

  • Cedd Burge 0

    I am using the `SVsSolutionBuildManager` / `IVsSolutionBuildManager2`, and there is a breaking change in the way that it works (at least after updating to use an `AsyncPackage`).
    Previously, the `Opened` event was called for every solution opened. In VS 2019, the `Opened` event is not called when a solution is opened from the startup dialog. I imagine this happens because by the time I connect to the events, the solution is already open. It is fixable by just calling the event handler manually during initialization.

  • Gerard Veneman 0

    I’m trying to use the Power Query SDK in Visual Studio 2019 and changed 16.0 to 17.0 in both the manifest.json and catalog.json file inside the .vsix archive. I then ‘opened’ the .vsix file from my explorer (double-clicked). The vsix-installer opens and asks me where to install the extension, but only supplies Visual Studio 2017 as install target, although I have both VS17 and VS19 installed on my computer. What am I doing wrong?

  • Vardan Tovmasyan 0

    It helped me too, thanks a lot!

Feedback usabilla icon