2015-11-04 52 views
8

我使用ASP.NET 5测试版8 Entity Framework 7测试版8DNX:错误:无法加载应用程序或执行命令“EF”

我创建了一个新的类库包使用。

我跑到下面安装软件包提示:

Install-Package EntityFramework.SqlServer -Pre 
Install-Package EntityFramework.Commands -Pre 
Install-Package Microsoft.AspNet.Identity.EntityFramework -Pre 

project.json

{ 
"version": "1.0.0-*", 
"description": "MARS Class Library", 
"authors": [ "myname" ], 
    "tags": [ "" ], 
    "projectUrl": "", 
    "licenseUrl": "", 
    "frameworks": { 
    "dnx451": { } 
    }, 
    "dependencies": { 
    "EntityFramework.Commands": "7.0.0-beta8", 
    "EntityFramework.SqlServer": "7.0.0-beta8", 
    "Microsoft.AspNet.Identity.EntityFramework": "3.0.0-beta8", 
    } 
} 

在我的包管理器控制台我浏览到我的src\project目录在其中project.json位于和运行任何dnxef命令例如:

dnx ef migrations --help 

 dnx ef migrations add InitialMigration 

不过,我得到以下错误:

dnx : Error: Unable to load application or execute command 'ef'.

At line:1 char:1

  • dnx ef migrations --help

  • ~~~~~~~~~~~~~~~~~~~~~~~~

    • CategoryInfo : NotSpecified: (Error: Unable t...e command 'ef'.:String) [], RemoteException
    • FullyQualifiedErrorId : NativeCommandError

我有一个的DbContext类和模型类,但错误似乎与不能够理解他们的关键字ef所有。

我错过了什么?

回答

16

解决方案:

添加ef命令添加到您project.json

"commands": { 
     "ef": "EntityFramework.Commands" 
    } 
相关问题