我正在使用 Microsoft.EntityFrameworkCore.SqlServer
(3.1) 在 .NET Core 3.1 库中。这个库在运行时由一个可执行的 .NET Core 项目加载,使用:
Assembly.LoadFrom('some.dll');
尝试从 DbSet
检索数据时,我得到以下异常:System.PlatformNotSupportedException: 'Microsoft.Data.SqlClient is not supported on this platform.'
我想这与在运行时加载库有关,但我不明白为什么?
我尝试了各种不同的东西,比如覆盖
Microsoft.Data.SqlClient
1.1 或 2.0 版的库,但没有任何成功。
最佳答案
我收到了这条消息:System.PlatformNotSupportedException: Microsoft.Data.SqlClient is not supported on this platform.
我的解决方案:
Newtonsoft
命名空间,例如安装 Microsoft.Data.SqlClient 后找不到 Newtonsoft.Json 和此命名空间,然后从 NuGet 获取 Newtonsoft.Json 依赖项。 关于c# - 此平台不支持 Microsoft.Data.SqlClient - Entity Framework Core 3.1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62514719/