Skip to content
Advertisement

No executable found matching command “dotnet-ef” in linux

I’m having this error No executable found matching command “dotnet-ef” when I try add migration with ‘dotnet ef migrations add Initial’ command in linux cli. I’ve installed dotnet sdk 2.1, I can build and run projects.

System is Debian Linux 9 64 bit In windows env (win 10) everything works well on same setup.

How to fix this?

Update: dotnet --info gives that output:

.NET Command Line Tools (2.1.105)

Product Information:
 Version:            2.1.105
 Commit SHA-1 hash:  141cc8d976

Runtime Environment:
 OS Name:     debian
 OS Version:  9
 OS Platform: Linux
 RID:         debian.9-x64
 Base Path:   /usr/share/dotnet/sdk/2.1.105/

Host (useful for support):
  Version: 2.1.5
  Commit:  290303f510

.NET Core SDKs installed:
  2.1.105 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.5 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.5 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.0.7 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.5 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

Advertisement

Answer

As pointed in the comments:

The 2.1 SDK doesn’t mean you are using the .NET Core 2.1 runtime. .NET Core SDK versions are/were not in sync with the .NET Core runtime (this will change and be in sync again starting from .NET Core SDK 2.2)

The out of the box EF Core tools were only introduced with .NET Core 2.1, not 2.0.

  • .NET Core SDK 2.1.10x and 2.1.20x only ship with .NET Core 2.0
  • .NET Core SDK 2.1.30x and 2.1.40x ship with .NET Core 2.1.

Only the .NET Core SDKs >= 2.1.300 do have the tools globally installed.

For the .NET Core SDKs older than that, you need to add the <DotNetCliToolReference> to the csproj of your project to make it available.

Even if your project targets .NET Core 2.0 but you have 2.1 runtime installed, the globally installed tools will work.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement