Skip to main content
edited tags
Link
Erik Eidt
  • 27.5k
  • 2
  • 34
  • 56
added 2 characters in body
Source Link
marc_s
  • 759.9k
  • 186
  • 1.4k
  • 1.5k

I'm trying to create an assembly from .net coreNET Core dll in sql serverSQL Server 2017:

CREATE ASSEMBLY my_assembly FROM 'C:\Temp\MyDll.dll' WITH PERMISSION_SET = SAFE;

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'm gettingI 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?

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'm getting 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?

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?

Source Link
Amir M
  • 560
  • 2
  • 10
  • 31

SQL Server error when trying to create assembly from .net core dll

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'm getting 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?