I'm trying to create an assembly from .NET Core dll in SQL Server 2017:
CREATE ASSEMBLY my_assembly FROM 'C:\Temp\MyDll.dll' WITH PERMISSION_SET = SAFE; This is the dll csproj :
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netcoreapp3.1</TargetFramework> <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'"> <PlatformTarget>x64</PlatformTarget> </PropertyGroup> <ItemGroup> <PackageReference Include="Microsoft.SqlServer.SqlManagementObjects" Version="161.46041.41" /> </ItemGroup> </Project> When I'm running the query I get the following error:
Assembly 'MyAssembly' references assembly 'system.runtime, version=4.2.2.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a.', which is not present in the current database. SQL Server attempted to locate and automatically load the referenced assembly from the same location where referring assembly came from, but that operation has failed (reason: 2(The system cannot find the file specified.)). Please load the referenced assembly into the current database and retry your request.
How can I fix it?