Rick Strahl's Weblog  

Wind, waves, code and everything in between...
.NET • C# • Markdown • WPF • All Things Web
Contact   •   Articles   •   Products   •   Support   •   Advertise
Sponsored by:
Markdown Monster - The Markdown Editor for Windows

VSIX Installer Extension Manifest and Visual Studio Version Numbers


:P
On this page:
Edit this Post

I ran into a problem with my VSIX installer today when I tried to install my updated Visual Studio Extension for the Markdown Monster Addin Project Template. This is a Visual Studio 2019 Project Template for Markdown Monster that creates a ready to run addin for Markdown Monster that can then be customized to integrate with a variety of features in Markdown Monster.

Anyway, today I needed to update this template to use a new version of .NET since I recently switched Markdown Monster to require .NET 4.7.2 due to .NET Standard compatibility (you can read about some of the why's here). In order to do this I had to update the old template which still used the .NET 4.6.2 framework.

So I updated the framework version in my project template to 4.7.2 and happily recompiled my VSIX project expecting it to just work. I ran it in Debug mode and it worked so I was like "Cool - that was easy for a change.".

But that was where the cool part stopped.

Visual Studio Version Install Option Missing

My very first attempt to try to install the compiled VSIX from disk, didn't show me Visual Studio 2019 as an installation option Instead the installer only installed for Visual Studio 2017. My first thought was that the addin was already installed in 2019, but when I looked in the extensions dialog - nothing; it's not installed. Huh?

Turns out, the problem was the version configuration for Visual Studio versions because - surprise surprise - Visual Studio uses some funky wanna be SemVer version scheme for its versioning that doesn't work like you'd expect SemVer to work.

You need to specify which versions of Visual Studio your extension supports. I want to support VS 2017 and VS 2019 so it seems reasonable to set the following in source.extension.vsixmanifest:

<Installation>
    <InstallationTarget Version="[15.0,16.0)" Id="Microsoft.VisualStudio.Community" />
    <InstallationTarget Version="[15.0,16.0)" Id="Microsoft.VisualStudio.Pro" />
    <InstallationTarget Version="[15.0,16.0)" Id="Microsoft.VisualStudio.Enterprise" />
</Installation>

Versions 15 and 16 refer to Visual Studio 2017 and Visual Studio 2019 respectively. This works for Visual Studio 2017 (v15), but fails for my current Visual Studio 2019 Enterprise installation.

Turns out the reason is that my version of Visual Studio is not 16.0 but 16.4 which is the 4th revision of 2019. The only way I could get this to work is to use 17.0 as the version number:

<Installation>
    <InstallationTarget Version="[15.0,17.0)" Id="Microsoft.VisualStudio.Community" />
    <InstallationTarget Version="[15.0,17.0)" Id="Microsoft.VisualStudio.Pro" />
    <InstallationTarget Version="[15.0,17.0)" Id="Microsoft.VisualStudio.Enterprise" />
</Installation>

and that worked to now at least show me Visual Studio 2019 as an installation option.

Note Visual Studio doesn't use SemVer but some funky versioning scheme that requires that you use the next full .0 version. I tried using 16.5 and 16.9 for the upper bound and those values did not work. I had to use 17.0. Thanks to Mads' Blog Post to discover that little unobvious gem which eventually ended my version number bingo.

Finally you can also use Version="[15.0,)"for the version to specify all future versions as in:

<InstallationTarget Version="[15.0,)" Id="Microsoft.VisualStudio.Community" />

This too works, although I'm not sure if that's such a good idea since VS Extension APIs keep changing so much. Keeping extensions up to date requires some effort.

Disabled Visual Studio Version Checkboxes

Ok so that gets me my Visual Studio 2019 extension installation prompt, but… it still wasn't working correctly. I ended up with disabled checkboxes when running the installer:

This time the issue was caused by the missing core editor despendency which also needs to have a version range defined. I had updated the installation targets but didn't update the Prerequisites which caused the disabled checkboxes.

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

Once I fixed this setting I finally had success:

Note that both of these settings - the Installation Targets and Prerequisites - can also be set through the Addin Project dialog:

So you can set those same values there instead of in the source.extension.vsmanifest file.

Summary

Visual Studio extensions are always a pain in the ass. The documentation is terrible and VSIX installer is absolutely god-awful. But hopefully this post helps you find this information if this same kind of version conflict happens to you, so you don't have to waste an hour or a few trying to randomly change things in hope that it'll fix the problem…

Resources

Posted in Visual Studio  Addins  

The Voices of Reason


 

Dmitry Pavlov
December 19, 2019

# re: VSIX Installer Manifest and Visual Studio Version Numbers

There was a nice post about that by Mads Kristensen - Visual Studio extensions and version ranges demystified.


Rick Strahl
December 19, 2019

# re: VSIX Installer Extension Manifest and Visual Studio Version Numbers

@Dmitry - thanks, Mads' post is referenced in this post above.


Rick Strahl
December 19, 2019

# re: VSIX Installer Extension Manifest and Visual Studio Version Numbers

@Dmitry - added an additional link to it in the Resources section as I meant to do 😄


Viktor Márk Tóth
July 21, 2020

# re: VSIX Installer Extension Manifest and Visual Studio Version Numbers

Hello Rick! Thank you for your article, it was very useful for me!

After the vsix update, I found an exception at Team Explorer/My work/In progress work and Available Work items, where I got this exception: System.Windows.Markup.XamlParseException: Provide value on 'System.Windows.StaticResourceExtension' threw an exception. ---> System.Exception: Cannot find resource named 'Microsoft.TeamFoundation.Controls.WPF.DraggableListBox'.

It occurs at VS 2017 and 2019, but works perfectly in 2015. Do you have any idea, what can be the issue here with the vsix xml?

Thanks, Viktor


Yann Duran
February 01, 2021

# re: VSIX Installer Extension Manifest and Visual Studio Version Numbers

Hi Rick!

You should be able to have 16.4 if you replace the ) with a ] - I think it's only the ) that requires the next x.0 version number.


Peter Brightman
March 17, 2021

# re: VSIX Installer Extension Manifest and Visual Studio Version Numbers

Thanks for this article, it helped me a lot. Now my vsix appears for VS 2017 as well as VS 2019. I can also install the vsix, but when i use it in VS, i get a failure message, my TemplateWizard dll cannot be loaded somehow.


Bryant
July 29, 2022

# re: VSIX Installer Extension Manifest and Visual Studio Version Numbers

Hi Rick,

I agree about the PITA nature of VSIX. I'm running into a targetversion issue that led me here. I'm curious if you have experience with it.

I am updating an existing item templates VSIX project. The item templates make use of the WizardExtention. Those templates can only refer to a single version of VS. I need to have a set of item templates for VS2019 and a set for VS2022 because of the required difference in the WizardExtension values. I have attempted to get that to happen using the TargetVersion setting on the Assets tab in the Extension Manifest editor. What I am expecting is that if I set an asset to v17 or above, v16 won't be able to see it. And that isn't happening whether I use the UI or the XML document.

In the VSIX manifest schema description it says "TargetVersion - the version range to which the given asset applies. Used for shipping multiple versions of assets to different versions of Visual Studio." so I think I'm in the right place.

Are you familiar with the settings or do you have any other ideas?

Thanks


West Wind  © Rick Strahl, West Wind Technologies, 2005 - 2024