Hello people,
Good afternoon!
In this post I will show you how to quickly resolve .NET Framework DLL Assembly signing issues in SQL Server. This error occurs when any SQLCLR routine uses some server .NET Framework DLL and after some system update, the CLR user loses Unsafe Assembly permissions or some DLL is updated.
Problem Statement
When this error occurs, all of your CLR SP's that use the affected DLL will display the error message below:
Could not load file or assembly or one of its dependencies. Assembly in host store has a different signature than assembly in GAC (Exception from HRESULT: 0x80131050)
Solution
To solve this signature problem, we will again grant the Unsafe Assembly permission to the CLR user and then change the Assembly of the DLL's that are showing an error pointing to the DLL that our CLR routine expects.
1 2 3 4 5 6 7 8 9 10 11 12 13 | USE [master] GO GRANT UNSAFE ASSEMBLY TO CLR_User USE [CLR] GO ALTER ASSEMBLY [System.DirectoryServices] FROM 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.DirectoryServices.dll' ALTER ASSEMBLY [System.DirectoryServices.Protocols] FROM 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.DirectoryServices.Protocols.dll' |
From now on, we can use our SP again:
That's it folks!
To the next!
sql server, sql, Could not load file or assembly or one of its dependencies. Assembly in host store has a different signature than assembly in GAC (Exception from HRESULT: 0x80131050), assembly, gac
sql server, sql, Could not load file or assembly or one of its dependencies. Assembly in host store has a different signature than assembly in GAC (Exception from HRESULT: 0x80131050), assembly, gac