Entity Framework tools -- "No executable found matching command 'dotnet-ef'"
See original GitHub issueSteps to reproduce
- Install RC4 VS 2017
- Create an ASP.NET Core/ASP.NET Core web project.
- Add EF tools to .csproj
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.Dotnet" Version="1.0.0-msbuild3-final" />
- In project folder run dotnet restore
- Try to run EF tools with “dotnet ef” commands.
Expected behavior
EF tools run
Actual behavior
No executable found matching command "dotnet-ef"
Environment data
dotnet --info
output:
.NET Command Line Tools (1.0.0-rc4-004802)
Product Information:
Version: 1.0.0-rc4-004802
Commit SHA-1 hash: 2384b5f1a8
Runtime Environment:
OS Name: Windows
OS Version: 10.0.14393
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\1.0.0-rc4-004802
.csproj contents:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.0" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.Dotnet" Version="1.0.0-msbuild3-final" />
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0-msbuild3-final" />
</ItemGroup>
</Project>
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (6 by maintainers)
Top Results From Across the Web
No executable found matching command "dotnet-ef"
Entity Framework Core 1.0. You should just need to update the tools section of your project.json file to include this: "Microsoft.
Read more >No executable found matching command "dotnet-ef" even ...
I want to Migrate my Database with Models. I am using EF Core 2.0 Preview. dotnet ef migrations add InitialCreate dotnet : No...
Read more >Fix "No executable found matching command dotnet-ef ...
How to fix the "No executable found matching command dotnet-ef" error in Visual Studio 2017 when using Entity Framework Core 2.x with ASP....
Read more >.NET Core Errors - Part One - Solution For “No Executable ...
In this post, we will see how to resolve the error, No executable found matching command “dotnet-ef”. This error comes when we want...
Read more >Troubleshooting the dotnet ef command for EF Core ...
No executable found matching command "dotnet-ef" ... I recorded my Entity Framework Core: Getting Started course on Pluralsight while VS2017 ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@emgarten
1.0.1
has the same issue, it’s pretty frustrating, pages of google results and no working solution yet…Cause
This is caused by a case sensitive comparison on the package id. The repro steps use a lowercase n in Dotnet while the actual package contains an upper case N. https://www.nuget.org/packages/Microsoft.EntityFrameworkCore.Tools.DotNet/1.1.0-preview4-final
Package ids should be compared case insensitively. The current code causing the issue is here: https://github.com/dotnet/cli/blob/4b00570f68c0f9709dec97ef6c10f439b7075e96/src/Microsoft.DotNet.Cli.Utils/CommandResolution/ProjectToolsCommandResolver.cs#L152
Fix
After changing to the code below
dotnet ef
runs fine:Note the target framework compare was also case sensitive which could cause issues. The best way to check framework equality is to let
NuGetFramework
perform the comparison using Equals or ==.Workarounds
Changing the DotNetCliToolReference to use the exact casing also solves the issue.
However since these tools can only be added manually currently, and there is no intellisense or UI to help with this it users may often enter these ids incorrectly.