user1109270 user1109270 - 15 days ago 8
ASP.NET (C#) Question

VS 2015 .Net core Migration

I'm using dotnet ef migrations add [abc] command add migration but it gives following error: No executable found matching command "dotnet-ef"

I have tried from command prompt as well as package manager console
but gives same error.
I have checked the path as well, i'm running command where my project.json sits.

Microsoft.EntityFrameworkCore.SqlServer is already installed.

project.json code is as follows:

{
"version": "1.0.0-*",
"dependencies": {
"Bloomerang.Domain": "1.0.0-*",
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.1"
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
},
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.0.0-preview1-final",
"imports": [
"portable-net45+win8+dnxcore50",
"portable-net45+win8"
]
}
}

Answer

If you need to use .NET Core CLI commands then your project.json should include the below items. Specially the Microsoft.EntityFrameworkCore.Design package.I cannot see it on your file.So you need to install it before use those commands.

project.json

{
    "dependencies": {
        "Microsoft.EntityFrameworkCore.Design": {
            "type": "build",
            "version": "1.0.0-preview2-final"
        }
    },

    "tools": {
        "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final"
    },

    "frameworks": {
        "netcoreapp1.0": { }
    }
}