.NET Core 1.0和EntityFramework 7不兼容 [英] .NET Core 1.0 and EntityFramework 7 Not Compatible

查看:156
本文介绍了.NET Core 1.0和EntityFramework 7不兼容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经升级到Visual Studio Code 1.0.0,并且正在尝试在新版本发布之前对我之前在VSCode中从事的ASP.NET Core项目进行改造。 VSCode现在在配置方面似乎大不相同。我已经使用过本教程这些示例。我在取得项目的MVC6方面并正常工作方面取得了一定的成功,但是EntityFramework 7方面是不行的。

I've upgraded to Visual Studio Code 1.0.0 and I'm trying to retrofit an ASP.NET Core project I was working on in VSCode previously, before the new release. VSCode is seemingly quite different now in terms of configuration. I've worked with this tutorial and these samples. I'm having reasonable success getting the MVC6 aspect of my project compiling and working properly, but the EntityFramework 7 aspect is a no-go.

当我执行 dotnet恢复在我的项目上,出现以下错误:

When I do a dotnet restore on my project, I get the following error:

Package EntityFramework.Core 7.0.0-rc1-final is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0).

我一直在对project.json进行或多或少的随机试验,以期找到解决方案,但我似乎并没有取得太大进展。 netcoreapp1.0还是太新而不能与EntityFramework兼容吗?可以使用哪些选项?

I've been experimenting more-or-less randomly with the project.json in the hopes of finding a solution, but I don't seem to be making much progress. Is netcoreapp1.0 still just too new to be retro-compatible with EntityFramework? What options are available?

顺便说一下,这是我的project.json。它是上面提到的HelloMvcApi示例中的大量库存,但是添加了EntityFramework.Core依赖项:

Here's my project.json, by the way. It's pretty much stock from the HelloMvcApi sample mentioned above, but with the addition of the EntityFramework.Core dependency:

{
  "compilationOptions": {
    "emitEntryPoint": true,
    "debugType": "portable"
  },
  "dependencies": {
    "Microsoft.AspNetCore.Mvc.Core": "1.0.0-*",
    "Microsoft.AspNetCore.Mvc.Formatters.Json": "1.0.0-*",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-*",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*",
    "Microsoft.Extensions.Logging.Console": "1.0.0-*",
    "EntityFramework.Core": "7.0.0-rc1-final",
    "Microsoft.NETCore.App": {
      "type": "platform",
      "version": "1.0.0-*"
    }
  },
  "frameworks": {
    "netcoreapp1.0": {
      "imports": [
        "portable-net45+wp80+win8+wpa81+dnxcore50"
      ]
    }
  },
  "tools": {
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": {
      "version": "1.0.0-*",
      "imports": "portable-net45+wp80+win8+wpa81+dnxcore50"
    }
  },
  "scripts": {
    "postpublish": "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%"
  }
}


推荐答案

有关RC2重大更改的公告


EntityFramework。* 包和名称空间将更改为 Microsoft.EntityFrameworkCore。*

The EntityFramework.* packages and namespaces are changing to Microsoft.EntityFrameworkCore.*

因此,您只需要切换引用即可指向更新的版本:

So you'll just need to switch your reference to point to the updated version :

"Microsoft.EntityFrameworkCore": "1.0.0-*",

这篇关于.NET Core 1.0和EntityFramework 7不兼容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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