问题描述
我有一个在.NETFramework
中创建的项目。我已按照https://docs.microsoft.com/en-us/dotnet/core/porting/上的步骤将解决方案转换为.NETStandard
。特别是解决方案中的所有项目都以.NETStandard
作为目标框架。在清理和构建项目时,使用.NETFramework
还原了多个软件包,但出现类似以下的错误/警告:
Warning NU1701 Package 'EntityFramework 6.1.3' was restored using '.NETFramework,Version=v4.6.1,.NETFramework,Version=v4.6.2,Version=v4.7,Version=v4.7.1,Version=v4.7.2,Version=v4.8' instead of the project target framework '.NETStandard,Version=v2.1'. This package may not be fully compatible with your project.
程序包管理器控制台中是否有一种方法可以运行dotnet restore
强制还原来自.NETStandard
?
解决方法
Entity Framework 6.1.3完全不支持.NET Standard ,仅支持.NET Framework;这是因为EF 6.1.3于2015年发布,甚至还没有.NET Standard。
您需要使用Entity Framework 6.3.0或更高版本才能与.NET Standard兼容。
您应该使用最新版本:Entity Framework 6.4.4。