.NET 4.6.1上的Entity Framework Core 2.0

use*_*921 20 entity-framework entity-framework-core

微软刚刚宣布 Entity Framework Core 2.0现在将在.NET Standard 2.0上运行.

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

但是,当我尝试添加最新的NuGet包时,我收到一个错误,告诉我我使用的是错误的版本:

 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. 
Run Code Online (Sandbox Code Playgroud)

如果根据公告,我可以使用带有.NET Framework 4.6.1的EF Core 2.0,有人可以解释一下,如果可能的话,举个例子来看看它是什么样的.

use*_*921 5

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

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

<package id="NETStandard.Library.NETFramework" version="2.0.0-preview1-25305-02" targetFramework="net461" />
Run Code Online (Sandbox Code Playgroud)

  • 不推荐使用此软件包,而推荐使用Nuget 3.6+ (2认同)