No executable found matching command "dotnet-ef"
Specific to VS2017 15.3 or greater and ASP.NET CORE 2.0 or later...
Install nuget for db provider via command line or nuget package manager.
dotnet add package Microsoft.EntityFrameworkCore.SqlServer
Add following section to .csproj
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet"
Version="2.0.0" />
</ItemGroup>
Install design time tools via commandline or nuget manager in VS2017.
dotnet add package Microsoft.EntityFrameworkCore.Design
This enables dotnet ef * at the command line in the project directory.
Enables dotnet ef * commands at the command line in the project directory,
dotnet ef migrations add Initial
dotnet ef database update Initial
dotnet ef dbcontext scaffold
Entity Framework Core 1.1
Adding in on this if you're using VS2017 with the new .csproj projects without a project.json file
you need to edit the .csproj file (right click it in solution explorer and click edit whatever.csproj) and then paste this in
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet">
<Version>1.0.0-*</Version>
</DotNetCliToolReference>
</ItemGroup>
courtesy of : https://github.com/aspnet/EntityFramework/issues/7358#issuecomment-278379967
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.