当前的运行时目标框架与项目不兼容 [英] The current runtime target framework is not compatible with project
问题描述
将Entity Framework 7
添加到我的Asp.Net 5项目后,我尝试执行初始迁移.我正在遵循此文档.
I am attempting to perform an initial migration after adding Entity Framework 7
to my Asp.Net 5 project. I am following this documentation.
在我的project.json
中,我指定了:
"commands": {
"web": "Microsoft.AspNet.Server.Kestrel",
"ef": "EntityFramework.Commands"
},
"frameworks": {
"dnxcore50": { }
}
我正在尝试通过命令提示符在项目目录中执行以下命令:
I am attempting to execute the following command in the project directory via a command prompt:
dnx ef migrations add MyFirstMigration
但是出现以下错误:
System.InvalidOperationException:当前的运行时目标框架 与ProjectName不兼容.当前的运行时目标 框架:'DNX,版本= v 4.5.1(dnx451)请确保运行时 匹配project.json中指定的框架.
System.InvalidOperationException: The current runtime target framework is not compatible with ProjectName. The current runtime target framework: 'DNX, Version=v 4.5.1(dnx451) Please make sure the runtime matches a framework specified in project.json.
奇怪的是,我的project.json
确实瞄准了dnxcore50
.我还签入了global.json
:
The weird thing is that my project.json
is definitely targeting dnxcore50
. I have also checked in global.json
:
{
"projects": [ "src", "test" ],
"sdk": {
"version": "1.0.0-beta8",
"architecture": "x86",
"runtime": "coreclr"
}
}
我的程序包依赖项全部引用beta8:
And my package dependencies all reference beta8:
"dependencies": {
"EntityFramework.Commands": "7.0.0-beta8",
"EntityFramework.Core": "7.0.0-beta8",
"EntityFramework.SqlServer": "7.0.0-beta8",
"Hl7.Fhir.DSTU2": "0.90.2",
"Microsoft.AspNet.Authentication.Cookies": "1.0.0-beta8",
"Microsoft.AspNet.Authentication.OpenIdConnect": "1.0.0-beta8",
"Microsoft.AspNet.Diagnostics": "1.0.0-beta8",
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-beta8",
"Microsoft.AspNet.Mvc": "6.0.0-beta8",
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-beta8",
"Microsoft.AspNet.Server.Kestrel": "1.0.0-beta8",
"Microsoft.AspNet.StaticFiles": "1.0.0-beta8",
"Microsoft.AspNet.Tooling.Razor": "1.0.0-beta8",
"Microsoft.Dnx.Runtime": "1.0.0-beta8",
"Microsoft.Framework.Configuration.Json": "1.0.0-beta8",
"Microsoft.Framework.Configuration.UserSecrets": "1.0.0-beta8",
"Microsoft.Framework.Logging": "1.0.0-beta8",
"Microsoft.Framework.Logging.Console": "1.0.0-beta8",
"Microsoft.Framework.Logging.Debug": "1.0.0-beta8",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-beta8"
}
推荐答案
您需要将dnx451
添加到项目支持的框架中,或切换到.NET Core版本.
You need to either add dnx451
to your project's supported frameworks, or switch to a .NET Core version.
"frameworks": {
"dnxcore50": { },
"dnx451": { }
}
或运行:
dnvm install latest -r coreclr
或
dnvm use default -r coreclr
这篇关于当前的运行时目标框架与项目不兼容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!