NET 4.6.1上的Entity Framework Core 2.0 [英] Entity Framework Core 2.0 on .NET 4.6.1

查看:142
本文介绍了NET 4.6.1上的Entity Framework Core 2.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Microsoft 刚刚宣布,现在将运行Entity Framework Core 2.0在.NET Standard 2.0上。

Microsoft just announced that Entity Framework Core 2.0 will now run on .NET Standard 2.0.

.Net Standard 2.0与.NET Framework 4.6.1兼容(如果在这里是正确的术语)。

.Net Standard 2.0 is compatible (if that's the right term here) with .NET Framework 4.6.1.

但是,当我尝试添加最新的NuGet软件包我收到一条错误消息,告诉我我使用的版本错误:

However when I try add the latest NuGet package I get an error telling me that I'm using the wrong version:

 Install-Package : Could not install package 
 'Microsoft.EntityFrameworkCore.SqlServer 2.0.0-preview2-25332'. You are 
 trying to install this package into a project that targets 
 '.NETFramework,Version=v4.6.1', but 
 the package does not contain any assembly references or content files 
 that are compatible with that framework. 

如果根据公告可以将EF Core 2.0与.NET Framework 4.6.1结合使用,请说明,并在可能的情况下给出一个示例。

If according to the announcement I can use EF Core 2.0 with .NET Framework 4.6.1, can someone please explain, and if possible give an example of what that would look like.

推荐答案

似乎为了包含.NET在.NET 4.6.1项目中的Standard 2.0库中,您需要包括NetStandard.Library.NetFramework NuGet软件包。

It seems that in order to include .NET Standard 2.0 libraries within a .NET 4.6.1 project you need to include the NetStandard.Library.NetFramework NuGet package.

packages.config文件中当前版本的示例:

Example of current version in the packages.config file:

<package id="NETStandard.Library.NETFramework" version="2.0.0-preview1-25305-02" targetFramework="net461" />

这篇关于NET 4.6.1上的Entity Framework Core 2.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆