I need help installing EFCore 3.0 on .net framework 4.8

我的未来我决定 提交于 2021-01-27 23:14:26

问题


Whenever I want to update my EFCore reference to version 3 via NuGet on my NetFramework 4.8 project I get this error.

I confirm that I have netcore 3.0 SDK installed on my machine.

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.              

回答1:


This is a major breaking change in EF Core 3.0. But was fixed in EF Core 3.1.

Starting with 3.0, EF Core targets .NET Standard 2.1 and will run on all platforms that support this standard. This does not include .NET Framework.

Breaking changes included in EF Core 3.0

And here is the tracking issue with lots of background on this change: Target .NET Standard 2.1

And no future version of .NET Framework is planned to support .NET Standard 2.1. See eg:

Given many of the API additions in .NET Standard 2.1 require runtime changes in order to be meaningful, .NET Framework 4.8 will remain on .NET Standard 2.0 rather than implement .NET Standard 2.1. .NET Core 3.0 as well as upcoming versions of Xamarin, Mono, and Unity will be updated to implement .NET Standard 2.1.

Announcing .NET Standard 2.1.

So you must jump to EF Core 3.1 and at least .NET Framework. 4.7.2.

[UPDATE]

EF Core 3.1 reintroduces support for .NET Standard 2.0, rather than requiring .NET Standard 2.1 as was the case for EF Core 3.0. This means EF Core 3.1 will run on .NET Framework versions that support the standard.

And the .NET Framework 4.7.2 and higher fully support .NET Standard 2.0, and so EF Core 3.1 also. See here for the support matrix. https://devblogs.microsoft.com/dotnet/announcing-entity-framework-core-3-1-and-entity-framework-6-4/



来源:https://stackoverflow.com/questions/58175964/i-need-help-installing-efcore-3-0-on-net-framework-4-8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!