Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I am using using ASP.NET 5 Beta 8 with Entity Framework 7 Beta 8

I created a new class Library Package.

I ran the following install packages prompts:

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

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

In my package manager console I navigate to my src\project directory in which the project.json is located and run any dnx ef command e.g.:

dnx ef migrations --help

or

 dnx ef migrations add InitialMigration

However I get the following error:

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

I have a DBContext class and model classes but the error seems to be related to not being able to understand they keyword ef at all.

What am I missing?

like image 294
greay Avatar asked Nov 04 '15 09:11

greay


1 Answers

Solution:

Add the ef command to your project.json

   "commands": {
      "ef": "EntityFramework.Commands"
    }
like image 155
greay Avatar answered Oct 17 '22 08:10

greay