PoorMansTSqlFormatter icon indicating copy to clipboard operation
PoorMansTSqlFormatter copied to clipboard

SSMS 18.2 extension V1.6.13b does not load 'The 'FormatterPackage' package did not load correctly.' - cannot find the file Microsoft.VisualStudio.Shell.12.0

Open TaoK opened this issue 6 years ago • 46 comments

@RichardDavies and @Lukas31781 have had issues installing the SSMS extension (even latest version 1.6.13b) on SSMS 18.2. The setup completes successfully, but when opening SSMS the error The 'FormatterPackage' package did not load correctly. pops up, and the detail in ActivityLog.xml reports that:

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

The system cannot find the file specified. File name: 'Microsoft.VisualStudio.Shell.12.0, Version=14.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) 

WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. 

Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

TaoK avatar Aug 01 '19 14:08 TaoK

(from unrelated but similar-looking Issue #227)

TaoK avatar Aug 01 '19 14:08 TaoK

My very limited understanding of this issue, based on some other issues I've been working on, is that:

  • In my latest build environment, "Microsoft.VisualStudio.Shell.12.0" was resolving automatically to version 14.0.0.0, and therefore no longer included some of the types it should have contained, in its original version 12.0.0.0.
  • The correct fix to this would have been annotating the reference with a version for disambiguation, but in my confusion and following Visual Studio's "include reference" autofix suggestion, I added a reference to Microsoft.VisualStudio.Shell.Framework instead.
  • As a result, working SSMS support required the existing installation of a relatively recent version of visual studio - 2017, I think.

I think I have this fixed, but cannot test, so will appreciate some feedback shortly - I expect to have a new installer out today.

TaoK avatar Aug 04 '19 10:08 TaoK

New installer available: https://github.com/TaoK/PoorMansTSqlFormatter/releases/tag/1.6.16

I wasn't able to reproduce, so I can't be sure, but I believe this should address the error. Please let me know.

TaoK avatar Aug 04 '19 16:08 TaoK

For me, I have the same problem, first install msi 1.6.16 and get the same information as in version 1.6.13b, the second time I uninstall and install without any changes.

Lukas31781 avatar Aug 05 '19 06:08 Lukas31781

I still experience this issue with 1.6.16, unfortunately.

Recent, clean install of Windows 10 64-bit 1903, SSMS 18.2, .Net 3.5 and 2.0 installed on-demand by another application that required them. I don't have Visual Studio installed at all.

WyattBest avatar Aug 08 '19 20:08 WyattBest

I'm still getting the same error as well with 1.6.16.

RichardDavies avatar Aug 12 '19 23:08 RichardDavies

Same for me

KonstantinSat avatar Aug 14 '19 06:08 KonstantinSat

Same for me this morning

shaggygi avatar Aug 26 '19 11:08 shaggygi

Mine installed but the links under tools are greyed out

image

image

MessiDaGod avatar Aug 26 '19 17:08 MessiDaGod

Same issue. PoorSQL options are greyed out. I uninstalled and reinstalled as well. The VS2017 installation is working.

SQL Server Management Studio 15.0.18142.0 Microsoft Analysis Services Client Tools 15.0.1389.0 Microsoft Data Access Components (MDAC) 10.0.18362.1 Microsoft MSXML 3.0 6.0 Microsoft Internet Explorer 9.11.18362.0 Microsoft .NET Framework 4.0.30319.42000 Operating System 10.0.18362

bradfordgreene avatar Aug 27 '19 15:08 bradfordgreene

PoorSQL options are greyed out

immagine immagine

SQL Server Management Studio 15.0.18131.0 Microsoft Analysis Services Client Tools 15.0.1347.0 Microsoft Data Access Components (MDAC) 10.0.17134.1 Microsoft MSXML 3.0 6.0 Microsoft Internet Explorer 9.11.17134.0 Microsoft .NET Framework 4.0.30319.42000 Operating System 10.0.17134

federeeko avatar Aug 30 '19 08:08 federeeko

Hi I have the same issue

image

SQL Server Management Studio 15.0.18142.0 Outils clients Microsoft Analysis Services 15.0.1389.0 Microsoft Data Access Components (MDAC) 10.0.18362.1 Microsoft MSXML 3.0 4.0 5.0 6.0 Microsoft Internet Explorer 9.11.18362.0 Microsoft .NET Framework 4.0.30319.42000 Système d'exploitation 10.0.18362

alexiscomte avatar Sep 10 '19 08:09 alexiscomte

I used the 1.6.16 installler

alexiscomte avatar Sep 10 '19 08:09 alexiscomte

Installing SSMS 17.9 alongside 18.2 causes the extension to work! Going to do that until it's fixed; I missed this tool so much.

WyattBest avatar Sep 13 '19 20:09 WyattBest

Installing SSMS 17.9.1 made the formatting tool work for me too in SSMS, must be a missing library or something. Love the tool too, hope this gets fixed.

PETERHUP avatar Sep 25 '19 00:09 PETERHUP

Any update on when this will be fixed? (It shouldn't be marked resolved as there are still many people reporting this issue.)

RichardDavies avatar Oct 09 '19 20:10 RichardDavies

The issue still exists. Clean Windows Install /w SSMS 18.3 and PoorMansSQL Installer 1.6.16

drenkelfuss avatar Oct 22 '19 11:10 drenkelfuss

Same issue here. Any update?

shmulyeng avatar Oct 29 '19 15:10 shmulyeng

There are a lot of dependency problems with the current version of SSMS 18.3.1 and the extension.

In the end I took the projects and re-referenced them against the Nuget versions of their dependencies and upped the .net version to 4.6 and built them and copied them to the X:\Program Files (x86)\PoorMansTSqlFormatterSSMSExtension folder (replace X with your drive letter) and removed the LinqBridge.dll file (seems to come free with the .net install).

Happy to share those DLLs if people want them (https://drive.google.com/open?id=1LI1nlRmlPNg1EkW-B_ydwzAzrHfbJ8m3) - not really an ideal solution but may help.

As a caveat it's had limited testing (under 5 minutes - once it worked a few times and reformatted SQL didn't really do much else) on a single newly built machine and has no guarantee of it working in your environment.

aphalon avatar Nov 01 '19 09:11 aphalon

Happy to share those DLLs if people want them

This works for me on a fresh german Win10 + SSMS 18.3.1. Thanks!

Trallali avatar Nov 02 '19 21:11 Trallali

@aphalon : can you make a PR? I like to use your solution as well, but randomly downloading dll's from an untrusted source doesn't make me feel comfortable 😄

tkvw avatar Nov 13 '19 16:11 tkvw

Using SSMS 18.4 and Windows 10 v1903 -- I am still experiencing this problem using PoorSQL 1.6.16. "FormatterPackage' package did not load correctly." and the PoorSQL menu options are disabled. I have another PC with the same configuration, and it works fine on that unit.

m1hammer avatar Jan 16 '20 15:01 m1hammer

Installing VS Isolated Shell solved my issue. I have SSMS 18.4 and PMSF 1.6.16

https://aka.ms/VS2015/IsoShell/en-US

eng1n88r avatar Jan 17 '20 15:01 eng1n88r

Same issue here, using SSMS 18.4, Windows 10 version 1909 and Visual Studio 2019 version 16.4. The file C:\Users\{my_user_name}\AppData\Roaming\Microsoft\AppEnv\15.0\ActivityLog.xml records this message:

CreateInstance failed for package [FormatterPackage]Source: "mscorlib" Description: Could not load file or assembly "Microsoft.VisualStudio.Shell.12.0, Version=14.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.12.0, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" or one of its dependencies. The system cannot find the file specified.
File name: "Microsoft.VisualStudio.Shell.12.0, Version=14.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)

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

When SSMS finishes loading, the two options for Poor SQL are grayed out under the Tools menu.

Will there be a new version that solves this in SSMS 18.4?

jmoralesv avatar Mar 01 '20 05:03 jmoralesv

@jmoralesv Installing the missing "VS isolated shell" solves the issue:

Installing VS Isolated Shell solved my issue. I have SSMS 18.4 and PMSF 1.6.16

https://aka.ms/VS2015/IsoShell/en-US

KonstantinSat avatar Mar 01 '20 07:03 KonstantinSat

Helped me too. Running SSMS 18.5, PSMF 1.6.16 and VS 16.6.0

@jmoralesv Installing the missing "VS isolated shell" solves the issue:

obohaciak avatar Jun 09 '20 10:06 obohaciak

The issue seems to be with a binding redirect missing from SSMS.

If you edit ssms.exe.config (by default at C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE) and add the following line inside the assemblyBinding element the package will load:

<dependentAssembly> <assemblyIdentity name="Microsoft.VisualStudio.Shell.12.0" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/> <bindingRedirect oldVersion="2.0.0.0-15.0.0.0" newVersion="15.0.0.0"/> </dependentAssembly>

There's one for shell 9.0, 10.0, and 14.0 just not one for 12.0. I took the above from the visual studio exe.config. This will get cleared and have to be re-done any time you update SSMS.

WereGoingOcean avatar Jun 29 '20 12:06 WereGoingOcean

The issue seems to be with a binding redirect missing from SSMS.

If you edit ssms.exe.config (by default at C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE) and add the following line inside the assemblyBinding element the package will load:

<dependentAssembly> <assemblyIdentity name="Microsoft.VisualStudio.Shell.12.0" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/> <bindingRedirect oldVersion="2.0.0.0-15.0.0.0" newVersion="15.0.0.0"/> </dependentAssembly>

There's one for shell 9.0, 10.0, and 14.0 just not one for 12.0. I took the above from the visual studio exe.config. This will get cleared and have to be re-done any time you update SSMS.

This totally works!

kjo1 avatar Aug 28 '20 17:08 kjo1

I face the same issue on SSMS 18.6. Entries in ActivityLog.xml

<entry>
    <record>120</record>
    <time>2020/11/19 13:54:07.211</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>Begin package load [FormatterPackage]</description>
    <guid>{247609B1-2692-47D6-972A-976544685F0E}</guid>
  </entry>
  <entry>
    <record>121</record>
    <time>2020/11/19 13:54:07.373</time>
    <type>Error</type>
    <source>VisualStudio</source>
    <description>CreateInstance failed for package [FormatterPackage]Source: &apos;mscorlib&apos; Description: Could not load file or assembly &apos;Microsoft.VisualStudio.Shell.12.0, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&apos; or one of its dependencies. The system cannot find the file specified.&#x000D;&#x000A;System.IO.FileNotFoundException: Could not load file or assembly &apos;Microsoft.VisualStudio.Shell.12.0, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&apos; or one of its dependencies. The system cannot find the file specified.&#x000D;&#x000A;File name: &apos;Microsoft.VisualStudio.Shell.12.0, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&apos;&#x000D;&#x000A;   at System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type)&#x000D;&#x000A;   at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase)&#x000D;&#x000A;   at System.Activator.CreateInstanceFromInternal(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo)&#x000D;&#x000A;   at System.AppDomain.CreateInstanceFrom(String assemblyFile, String typeName)&#x000D;&#x000A;&#x000D;&#x000A;WRN: Assembly binding logging is turned OFF.&#x000D;&#x000A;To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.&#x000D;&#x000A;Note: There is some performance penalty associated with assembly bind failure logging.&#x000D;&#x000A;To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].&#x000D;&#x000A;</description>
    <guid>{247609B1-2692-47D6-972A-976544685F0E}</guid>
    <hr>80004005 - E_FAIL</hr>
    <errorinfo></errorinfo>
  </entry>

kaisp84 avatar Nov 19 '20 14:11 kaisp84

I had the same issue and came in to say that adding the binding settings to the SSMS config file (see fix above) worked. Great add in other than the opps in install.

jhullparkseed avatar Mar 09 '21 17:03 jhullparkseed