nicholas-ross/SSMS-Schema-Folders

Unable to load in SSMS 19.1

DerekRost opened this issue ยท 7 comments

Error when loading in 19.1. Compeltely removed the old SSMS directory and started from scratch but no difference. The extensions directory also contains an "application" folder that appears to be part of the SSMS install.

Error is as follows:
260
2023/07/13 17:23:44.565
Error
VisualStudio
CreateInstance failed for package [SsmsSchemaFolders.SsmsSchemaFoldersPackage, SsmsSchemaFolders, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a93ca1bbf74c67b4]Source: 'mscorlib' Description: Could not load file or assembly 'file:///c:\program files (x86)\microsoft sql server management studio 19\common7\ide\extensions\ssms schema folders\SsmsSchemaFolders.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515) System.IO.FileLoadException: Could not load file or assembly 'file:///c:\program files (x86)\microsoft sql server management studio 19\common7\ide\extensions\ssms schema folders\SsmsSchemaFolders.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515) File name: 'file:///c:\program files (x86)\microsoft sql server management studio 19\common7\ide\extensions\ssms schema folders\SsmsSchemaFolders.dll' ---> System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information. at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark) at System.Reflection.Assembly.LoadFrom(String assemblyFile, Evidence securityEvidence) 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) System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.

All the .dll files and the .pkgdef file are required. And they all need to be unblocked.

The File Explorer properties window will only show the unblock option when you have only one file selected. It won't show when you have multiple files selected. This is why I say to unblock the zip file first. There is also the PowerShell command to unblock multiple files Get-ChildItem | Unblock-File.

All the .dll files are required because of the way .Net checks that all dependencies exist when loading. It will then only load the dependencies (and check their dependencies) when used.

Worked like a charm. Thank you.

Hi Nicolas,
I'm installing a fresh SSMS 19.1 and try to install your tool again. But the extension is just not loading. No error, but also no result.
I copied the extracted folder into the given folder for SSMS 19 and unblocked the ZIP before extracting. And I used the unblockfiles.ps to unblock once more. Still no result.

Regards

Crefix commented

Yeah. same error here :(

The .ps file is not in the latest release. If you see it then you have downloaded the source code instead of the app files.

If you have extracted the zip file to its own folder then you will have a path like Downloads\SSMS-Schema-Folders-v1.5\SSMS Schema Folders\. Copy only the SSMS Schema Folders folder to the extensions folder. You should have the file path Extensions\SSMS Schema Folders\SsmsSchemaFolders.pkgdef.

Direct link to latest release: SSMS-Schema-Folders-v1.5.zip

That made a lot of sence.. Thanks, that worked perfectly

Crefix commented

Cheers mate! ๐Ÿ™Œ

Sorry for all the trouble, still adapting to SSMS (not my fav tho)