3

我已经升级到Visual Studio Code 1.0.0,我试图在新版本之前改进我以前在VSCode中工作的ASP.NET Core项目。就配置而言,VSCode看起来非常不同。我曾与this tutorialthese samples合作。我有合理的成功让我的项目的MVC6方面编译和工作正常,但EntityFramework 7方面是一个不行。.NET核心1.0和EntityFramework 7不兼容

当我做我的项目dotnet restore,我得到以下错误:

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

我与project.json找到解决办法的希望一直在尝试更多或更少的随机,但我似乎没有取得很大的进展。 netcoreapp1.0仍然太新以至于无法与EntityFramework兼容吗?有什么选择可用?

顺便说一句,这是我的project.json。这是从上面提到的HelloMvcApi样品相当多的股票,但由于增加了EntityFramework.Core依赖:

{ 
    "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%" 
    } 
} 

回答

8

正如this announcement of breaking changes in RC2提到:

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

所以你只需要切换你参考指向更新后的版本:

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

肯定有进展。但是现在'dotnet restore' yeilds:'Package Ix-Async 1.2.5与netcoreapp1.0'不兼容,'Package Remotion.Linq 2.0.2与netcoreapp1.0'不兼容。我知道这些与“Microsoft.EntityFrameworkCore”依赖关系有关,因为我运行了一个快速试用版。有关这些新错误的任何想法是或他们的一个单独的问题? – robbpriestley

+2

好的,我接受了这个答案。从技术上讲,我仍然有一个没有答案的问题,尽管有关联的问题(正如上面的评论中提到的那样)。我想我会在Github上发布它。链接是** [这里](https://github.com/aspnet/EntityFramework/issues/5152)**。也感谢@Pinpoint,但从技术上来说,这个答案似乎更早出现,并且更完整一些。 – robbpriestley