Visual Studio 2015 fail to load package because Microsoft.VisualStudio.Shell.15.0 fail to load
Asked Answered
C

3

7

I've built a Visual Studio extension for Visual Studio 2015 and 2017. I've developed it with 2017 and everything works great on 2017.

When I install it on VS 2015 I get an error message saying it failed to load my package. In the visual studio ActivityLog.xml file I see the following error.

How can I enable both VS 2015 and 2017 to run the extension?

CreateInstance failed for package [MainWindowPackage]
Source: 'mscorlib' 
Description: Could not load file or assembly 'Microsoft.VisualStudio.Shell.15.0, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. 

System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.Shell.15.0, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. 

File name: 'Microsoft.VisualStudio.Shell.15.0, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' at System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type) at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase) at System.Activator.CreateInstanceFromInternal(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo) at System.AppDomain.CreateInstanceFrom(String assemblyFile, String typeName) 
Collusion answered 5/9, 2017 at 11:52 Comment(0)
A
7

According to the error message, your extension dependency on Microsoft.VisualStudio.Shell.15.0, which is a VS 2017 assembly. So it is not contained in your VS 2015.

If you want your extension supports multiple versions of Visual Studio, you need to let your VSPackage to using only the features of the earliest version of Visual Studio that you support and program your VSPackage to adapt to the version of Visual Studio in which it is running. You could read this document: https://learn.microsoft.com/en-us/visualstudio/extensibility/choosing-between-shared-and-versioned-vspackages

And you also could reference the document that Supporting Multiple Versions of Visual Studio.

The custom installation path is "C:\Users\UserName\AppData\Local\Microsoft\VisualStudio\14.0\Extensions\". Please check your extension path to make sure the Microsoft.VisualStudio.Shell.15.0 is installed.

Amargo answered 6/9, 2017 at 3:37 Comment(0)
I
3

You should reference Microsoft.VisualStudio.Shell.14.0 and other assemblies from VS 2015 in your extension to support both VS 2015/2017.

Irascible answered 6/9, 2017 at 3:47 Comment(0)
A
0

I had similar issue for quite some time.

CreateInstance failed for package [Microsoft.Data.SAPClient.Design.SAPDataProviderPackage]
Source: 'mscorlib' Description: Could not load file or assembly 'file:///C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\$=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\BizTalk Server\3.0\InstallPath$Microsoft.Data.SAPClient.Design.dll' 
or one of its dependencies. The system cannot find the file specified.

I had to open Visual Studio Installer, find this VS Component (BizTalk) and remove it.

Amoretto answered 4/3 at 19:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.