TaoK / PoorMansTSqlFormatter

A small free .Net and JS library (with demo UI, command-line bulk formatter, SSMS/VS add-in, notepad++ plugin, winmerge plugin, and demo webpage) for reformatting and coloring T-SQL code to the user's preferences.
http://www.architectshack.com/PoorMansTSqlFormatter.ashx
GNU Affero General Public License v3.0
969 stars 268 forks source link

SSMS 18.1 extension V1.6.13 does not load 'The 'FormatterPackage' package did not load correctly.' - Assembly Version Mismatches #227

Closed CZEMacLeod closed 5 years ago

CZEMacLeod commented 5 years ago

After installing V1.6.13 and opening SSMS 18.1 I get the following error:

---------------------------
Microsoft SQL Server Management Studio
---------------------------
The 'FormatterPackage' package did not load correctly.

The problem may have been caused by a configuration change or by the installation of another extension. You can get more information by examining the file 'C:\Users\xxxx\AppData\Roaming\Microsoft\AppEnv\15.0\ActivityLog.xml'.

Restarting Visual Studio could help resolve this issue.

Continue to show this error message?
---------------------------
Yes   No   
---------------------------

Checking that file I see the following:

LegacySitePackage failed for package [FormatterPackage]Source: 'PoorMansTSqlFormatterSSMSLib' Description: 
Could not load file or assembly 'PoorMansTSqlFormatterPluginShared, Version=1.6.12.2816, Culture=neutral, PublicKeyToken=fb9a6042fd921db9' or one of its dependencies. 
The system cannot find the file specified. System.IO.FileNotFoundException: 
Could not load file or assembly 'PoorMansTSqlFormatterPluginShared, Version=1.6.12.2816, Culture=neutral, PublicKeyToken=fb9a6042fd921db9' or one of its dependencies. 
The system cannot find the file specified. 
File name: 'PoorMansTSqlFormatterPluginShared, Version=1.6.12.2816, Culture=neutral, PublicKeyToken=fb9a6042fd921db9'at PoorMansTSqlFormatterSSMSLib.GenericVSHelper..ctor(Boolean isVisualStudio, GetTextEditorKeyBindingScopeName keyBindingScopeNameDelegate, GetKeyBinding getKeyBindingDelegate, SetKeyBinding setKeyBindingDelegate)at PoorMansTSqlFormatterSSMSPackage.FormatterPackage.Initialize()at Microsoft.VisualStudio.Shell.Package.Microsoft.VisualStudio.Shell.Interop.IVsPackage.SetSite(IServiceProvider sp) 
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]. 

Doing a quick check of the assemblies included in the .msi installer PoorMansTSqlFormatterSSMSLib.dll seems to be built as V1.6.12 and linked against V1.6.12 as described above, but the included DLLs are V1.6.13. Guessing PoorMansTSqlFormatterSSMSLib needs to be rebuilt and the msi package updated.

RichardDavies commented 5 years ago

I'm also experiencing this same issue on a fresh install of SSMS 18.2.

mreyeros commented 5 years ago

Same issue for me on SSMS 18.1

UPDATE: After uninstalling both the visx for visual studio and the msi for SSMS, and reinstalling the new version all seems to be working correctly for me.

TaoK commented 5 years ago

Thanks for the prompt and comprehensive issue report, the installer is fixed, and available for download (on architechshack.com and github) as 1.6.13b.

RichardDavies commented 5 years ago

I've uninstalled it and installed 1.6.13b but I'm still getting the same error.

TaoK commented 5 years ago

@RichardDavies: could you check the activity log file as @CZEMacLeod did above, and confirm whether the detailed message also still looks the same, please?

The new package did work for me, and so far no-one else seems to have any issues with it...

RichardDavies commented 5 years ago

Here's what my log says:


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].

I hadn't looked that close before, but it does appear to be slightly different (although very similar).

Lukas31781 commented 5 years ago

HI,

I have the same problem, I have installed only SSMS 18.2 and tool 1.6.13b, Windows 10 1803

CreateInstance failed for package [FormatterPackage]Source: 'mscorlib' Description: Nie można załadować pliku lub zestawu 'Microsoft.VisualStudio.Shell.12.0, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' lub jednej z jego zależności. Nie można odnaleźć określonego pliku. System.IO.FileNotFoundException: Nie można załadować pliku lub zestawu 'Microsoft.VisualStudio.Shell.12.0, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' lub jednej z jego zależności. Nie można odnaleźć określonego pliku. 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) OSTRZEŻENIE: rejestrowanie informacji o powiązaniach zestawów jest wyłączone. Aby włączyć rejestrowanie błędów powiązań zestawów, ustaw wartość rejestru [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) równą 1. Uwaga: z włączeniem rejestrowania błędów powiązań zestawów wiąże się pewien spadek wydajności. Aby wyłączyć tę funkcję, usuń wartość rejestru [HKLM\Software\Microsoft\Fusion!EnableLog]. {247609B1-2692-47D6-972A-976544685F0E}


80004005 - E_FAIL

TaoK commented 5 years ago

I've opened issue #234 for this new issue @RichardDavies and @Lukas31781. Closing this one now.

srinivaspillalamarri commented 5 years ago

SSMS 18.1 extension 15.0 showing inactive menu