Moh*_*sen 5 .net entity-framework entity-framework-core
每当我想通过 NetFramework 4.8 项目上的 NuGet 将 EFCore 引用更新为版本 3 时,我都会收到此错误。
我确认我的机器上安装了 netcore 3.0 SDK。
Could not install package 'Microsoft.EntityFrameworkCore 3.0.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.8', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
Run Code Online (Sandbox Code Playgroud)
这是 EF Core 3.0 中的重大突破性更改。但在 EF Core 3.1 中已修复。
从 3.0 开始,EF Core 以 .NET Standard 2.1 为目标,并将在支持该标准的所有平台上运行。这不包括 .NET Framework。
以下是跟踪问题,其中包含有关此更改的大量背景信息:Target .NET Standard 2.1
并且 .NET Framework 的未来版本计划不支持 .NET Standard 2.1。参见例如:
鉴于 .NET Standard 2.1 中的许多 API 添加需要运行时更改才能有意义,.NET Framework 4.8 将保留在 .NET Standard 2.0 上,而不是实现 .NET Standard 2.1。.NET Core 3.0 以及即将推出的 Xamarin、Mono 和 Unity 版本将进行更新以实现 .NET Standard 2.1。
因此,您必须跳转到 EF Core 3.1 和至少 .NET Framework。4.7.2.
[更新]
EF Core 3.1 重新引入了对 .NET Standard 2.0 的支持,而不是像 EF Core 3.0 那样需要 .NET Standard 2.1。这意味着 EF Core 3.1 将在支持该标准的 .NET Framework 版本上运行。
.NET Framework 4.7.2 及更高版本完全支持 .NET Standard 2.0,EF Core 3.1 也是如此。请参阅此处了解支持矩阵。 https://devblogs.microsoft.com/dotnet/announcing-entity-framework-core-3-1-and-entity-framework-6-4/
| 归档时间: |
|
| 查看次数: |
9887 次 |
| 最近记录: |