我在向我的Asp.Net 5项目添加Entity Framework 7后尝试执行初始迁移.我关注这个
documentation.
在我的project.json中我指定了:
"commands": { "web": "Microsoft.AspNet.Server.Kestrel","ef": "EntityFramework.Commands" },"frameworks": { "dnxcore50": { } }
我试图通过命令提示符在项目目录中执行以下命令:
dnx ef migrations add MyFirstMigration
但是我收到以下错误:
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:
{ "projects": [ "src","test" ],"sdk": { "version": "1.0.0-beta8","architecture": "x86","runtime": "coreclr" } }
我的包依赖项都引用了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" }