I’m trying to create my first CLR assembly
having created a dll in VS I trying to use it in SqlServer
I try to create assembly with
CREATE ASSEMBLY SQLCLRroy
FROM ‘…SqlExternalFunctionsbinDebugnet5.0SQLExternalFunctions.dll’;
GO
which gives the error
Assembly ‘SqlExternalFunctions’ references assembly ‘system.runtime, version=5.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a.’, which is not present in the current database.
after trawling the net I try
CREATE ASSEMBLY [System.Runtime] FROM
‘C:Program FilesdotnetpacksMicrosoft.NETCore.App.Ref5.0.0refnet5.0System.Runtime.dll’
which gives the error
Warning: The Microsoft .NET Framework assembly ‘system.runtime, version=5.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a.’ you are registering is not fully tested in the SQL Server hosted environment and is not supported.
do I need to stop my .net code referencing system.runtime somehow?
the only package i have is System.Data.SqlClient
my .net code is simple
using System;
using System.Linq;
public static class SqlExternalFunctions
{
[Microsoft.SqlServer.Server.SqlFunction]
public static int myTest(int param )
{
return param;
}
roy bottomley is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.