I have a requirement set upon me to run a .NET Standard project from T-SQL. I'm finding very little info about this. I've set the TRUSTWORTHY setting to ON.
Importing the test program dll I'm receiving the error below.
I try importing the netstandard.dll from the C:\Program Files\dotnet\sdk\2.2.103\Microsoft\Microsoft.NET.Build.Extensions\net461\lib\
folder. This fails with the error below. But even after importing System.Data.Common from the same folder I keep receiving the error below.
When importing netstandard.dll from the C:\Program Files\dotnet\sdk\NuGetFallbackFolder\netstandard.library\2.0.3\build\netstandard2.0\ref
folder I receive no errors. However when calling the function I receive the error below.
Msg 10313, Level 16, State 51, Line 17
An error occurred while using the .NET Framework during IL compilation. The server may be running out of resources. Try running the query again. If the problem persist, contact a support professional.
System.IO.FileLoadException: Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. Assembly in host store has a different signature than assembly in GAC. (Exception from HRESULT: 0x80131050) See Microsoft Knowledge Base article 949080 for more information.
System.IO.FileLoadException:
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)
.NET Framework assemblies work without issue. Is running .NET Standard assemblies supported on SQL Server? If it's not supported what would be the workaround? Is there any solution more simple than calling a web service through .NET Framework and letting the web service call the .NET Standard code?
SQL Server supports .NET Framework 4 assemblies, using certain libraries listed at https://docs.microsoft.com/en-us/sql/relational-databases/clr-integration/database-objects/supported-net-framework-libraries?view=sql-server-2017.
The latest "what's new" page regarding CLR in SQL Server mentions only features added in SQL Server 2012: https://docs.microsoft.com/en-us/sql/relational-databases/clr-integration/clr-integration-what-s-new?view=sql-server-2017
.NET Core and .NET Standard are newer things (introduced in 2014 and 2016, respectively).
User contributions licensed under CC BY-SA 3.0