EF Core "dotnet ef" command not found in CI
A step ran dotnet ef ... but the dotnet-ef global (or local) tool is not installed on the runner. Install the tool before running any migration or database command in CI.
What this error means
A migration step fails with "Could not execute because the specified command or file was not found." naming dotnet-ef, or "No executable found matching command \"dotnet-ef\"".
Could not execute because the specified command or file was not found.
Possible reasons for this include:
* You misspelled a built-in dotnet command.
* ... the tool 'dotnet-ef' does not exist.
No executable found matching command "dotnet-ef".Common causes
The dotnet-ef tool is not installed
A clean runner has no global tools. dotnet ef is a separate .NET tool that must be installed explicitly, unlike built-in commands such as dotnet build.
A local tool manifest was not restored
If you use a dotnet-tools.json manifest, dotnet tool restore must run first, otherwise the local dotnet ef is unavailable.
How to fix it
Install the EF Core global tool
- Install
dotnet-efas a global tool in a step before migrations. - Ensure the tools directory is on PATH (setup-dotnet adds
~/.dotnet/tools). - Pin the tool version to match your EF Core package version.
- run: dotnet tool install --global dotnet-ef --version 8.0.*
- run: dotnet ef database updateRestore a local tool manifest
If EF is pinned in a manifest, restore it and invoke via dotnet ef (or dotnet tool run dotnet-ef).
dotnet tool restore
dotnet ef migrations listHow to prevent it
- Install or restore dotnet-ef in a dedicated step before any migration command.
- Pin the tool version to the EF Core version to avoid provider mismatches.
- Prefer a committed dotnet-tools.json manifest so the version is reproducible.