I've got a DLL library compiled in .NET Framework 4.6.1. It uses Microsoft.SqlServer.SqlManagementObjects v.140.17283.0
and Unofficial.Sql.Server.Management.Objects v17.4.1
that I've installed from NuGet
.
All works fine.
Now I want to use this library in a NetCoreApp2.1
project. I referenced the DLL and the dependencies.
But when I instance an object that creates a Server Object it crashes. The line that go error is:
sourceServer = new Server(GeneralSettings.Default.ServerNameSource);
and the error is:
Could not load type 'Microsoft.SqlServer.Server.SqlContext' from assembly 'System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
I think that .NetCoreApp
uses a System.Data
different from the library.
How can I fix this?