Monday, March 19, 2018

Entity Framework Core - No executable found matching command "dotnet-ef"

After adding the EntityFramework nuget package to my ASP.NET Core project and creating our DbContext(see below) I was ready to generate a first migration :

I opened the Package Manager Console in Visual Studio, browsed to the project folder(!),  and executed dotnet ef. I ended up with the following error message:

dotnet : No executable found matching command "dotnet-ef"

At line:1 char:1

+ dotnet ef

+ ~~~~~~~~~

    + CategoryInfo          : NotSpecified: (No executable f...and "dotnet-ef":String) [], RemoteExcep


    + FullyQualifiedErrorId : NativeCommandError

To solve this install the following 2 extra packages:

  • Microsoft.EntityFrameworkCore.Tools: Contains the Entity Framework Core Package Manager Console Tools. Includes Scaffold-DbContext, Add-Migration, and Update-Database.
  • Microsoft.EntityFrameworkCore.Tools.DotNet: Contains the Entity Framework Core .NET Command-line Tools. Includes dotnet-ef.

Remark: When trying to install the Microsoft.EntityFrameworkCore.Tools.DotNet package, I got the following error message:


I solved it by adding the package directly to the csproj file:

After doing that run a dotnet restore first. If you now try to execute dotnet ef, it should work:


1 comment:

Helen C Miller said...

A business consultant can make or break your business so before hiring one, business consultants are specific industry experts. Some might be good for small business and start-ups usually drawing up initial business plans which might not be useful for you. But sme business consultancy services helps you to target your potential customers and gets the business to a success level. SME Business Management Consultancy gives you TAX/VAT services in a great extend.