Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No executable found matching command "dotnet-ef"

I'm doing a project sample by using ASP.Net Core RC2 with Microsoft.EntityFramework.Core and SQLite.

I've followed this tutorial: https://damienbod.com/2015/08/30/asp-net-5-with-sqlite-and-entity-framework-7/

But, when I run this command :

dotnet ef migrations add FirstMigration 

I got this error :

No executable found matching command "dotnet-ef" 

Here is my project.json configuration:

{   "dependencies": {     "Microsoft.NETCore.App": {       "version": "1.0.0-rc2-3002702",       "type": "platform"     },     "Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final",     "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",     "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final",     "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-rc2-final",     "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0-rc2-final",     "Microsoft.Extensions.Configuration.Json": "1.0.0-rc2-final",     "Microsoft.Extensions.Logging": "1.0.0-rc2-final",     "Microsoft.Extensions.Logging.Console": "1.0.0-rc2-final",     "Microsoft.Extensions.Logging.Debug": "1.0.0-rc2-final",     "Microsoft.EntityFrameworkCore": "1.0.0-rc2-final",     "Microsoft.EntityFrameworkCore.Sqlite": "1.0.0-rc2-final"   },    "tools": {     "Microsoft.AspNetCore.Server.IISIntegration.Tools": {       "version": "1.0.0-preview1-final",       "imports": "portable-net45+win8+dnxcore50"     }   },    "frameworks": {     "netcoreapp1.0": {       "imports": [         "dotnet5.6",         "dnxcore50",         "portable-net45+win8"       ]     }   },    "buildOptions": {     "emitEntryPoint": true,     "preserveCompilationContext": true   },    "runtimeOptions": {     "gcServer": true   },    "publishOptions": {     "include": [       "wwwroot",       "Views",       "appsettings.json",       "web.config"     ]   },    "scripts": {     "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]   } } 
like image 774
Redplane Avatar asked May 17 '16 12:05

Redplane


1 Answers

Entity Framework Core 1.0

You should just need to update the tools section of your project.json file to include this:

"Microsoft.EntityFrameworkCore.Tools": {   "version": "1.0.0-preview1-final",   "imports": [     "portable-net45+win8+dnxcore50",     "portable-net45+win8"   ] } 

This should make the dotnet ef commands available.

Important

I should also note here that the dotnet ef commands will only be available when running them from the same directory which contains the project.json file.

Entity Framework Core 1.1
If you are having this problem again after upgrading to Entity Framework Core 1.1, be sure to replace the Microsoft.EntityFrameworkCore.Tools dependency with Microsoft.EntityFrameworkCore.Tools.DotNet version 1.1.0-preview4. There is no need to keep the imports section, either. For more information on this, see the "Upgrading to 1.1" heading under the Entity Framework Core 1.1 release announcement blog post.

like image 173
Daniel Grim Avatar answered Sep 22 '22 21:09

Daniel Grim