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

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

我正在使用 ASP.NET 5 Beta 8 和 Entity Framework 7 Beta 8

我创建了一个新的 class 库包。

我运行以下安装包提示:

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",
  }
}

在我的包管理器控制台中,我导航到 project.json 所在的 src\project 目录和 运行 任何 dnx ef 命令,例如:

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 class 和模型 classes,但错误似乎与根本无法理解它们的关键字 ef 有关。

我错过了什么?

解决方案:

ef 命令添加到您的 project.json

   "commands": {
      "ef": "EntityFramework.Commands"
    }