当我构建时,我收到一条错误:
EntityFramework 6.1.3不支持框架.NETCoreApp,Version = v1.0
我已经研究过这个问题并且明白问题出在project.json。
然而,在我的应用中实施其他人的解决方案却没有奏效。任何帮助都会很棒。感谢
project.json
{
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"dependencies": {
"EntityFramework": "6.1.3",
"Microsoft.ApplicationInsights.AspNetCore": "2.0.0",
"Microsoft.AspNet.Mvc": "5.2.3",
"Microsoft.AspNet.WebApi.Core": "5.2.3",
"Microsoft.AspNet.WebApi.Owin": "5.2.3",
"Microsoft.AspNetCore.Mvc": "1.1.2",
"Microsoft.AspNetCore.Routing": "1.1.1",
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.1",
"Microsoft.AspNetCore.Server.Kestrel": "1.1.1",
"Microsoft.AspNetCore.StaticFiles": "1.1.1",
"Microsoft.EntityFrameworkCore.Sqlite": "1.1.1",
"Microsoft.EntityFrameworkCore.SqlServer": "1.1.1",
"Microsoft.EntityFrameworkCore.Tools": "1.1.0",
"Microsoft.Extensions.Configuration.CommandLine": "1.1.1",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.1",
"Microsoft.Extensions.Configuration.FileExtensions": "1.1.1",
"Microsoft.Extensions.Configuration.Json": "1.1.1",
"Microsoft.Extensions.Logging": "1.1.1",
"Microsoft.Extensions.Logging.Console": "1.1.1",
"Microsoft.Extensions.Logging.Debug": "1.1.1",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.1",
"Microsoft.NETCore.App": "1.1.1"
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
},
"publishOptions": {
"include": [
"wwwroot",
"**/*.cshtml",
"appsettings.json",
"web.config"
]
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
"imports": "portable-net45+win8+dnxcore50",
"version": "1.0.0-preview2-final"
}
}
}
答案 0 :(得分:2)
实体框架6旨在与.NET Framework一起使用。对于.Net Core,您应该使用版本为1.1的Entity Framework Core。
以下是Microsoft Docs的链接,您可以在其中查看两者的比较:https://docs.microsoft.com/en-us/ef/efcore-and-ef6/index