.NET 4.6.1 上的实体框架核心 2.0

编程入门 行业动态 更新时间:2024-10-26 20:31:01
本文介绍了.NET 4.6.1 上的实体框架核心 2.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

Microsoft 刚刚宣布 Entity Framework Core 2.0 现在将运行在 .NET 标准 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 4.6.1 项目中包含 .NET 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 上的实体框架核心 2.0

本文发布于:2023-11-08 22:10:32,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1570589.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:实体   框架   核心   NET

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!