dotnet "Could not execute because the specified command ... was not found"
You invoked a .NET local tool (e.g. dotnet ef, dotnet csharpier) that has not been restored. The tool manifest declares it, but the tool was never installed into the repo, so the command does not exist.
What this error means
Running dotnet <tool> fails with "Could not execute because the specified command or file was not found", suggesting a missing tool or typo. It happens when CI runs the tool before dotnet tool restore.
Could not execute because the specified command or file was not found.
Possible reasons for this include:
* You misspelled a built-in dotnet command.
* You intended to execute a .NET program, but dotnet-ef does not exist.
* You intended to run a global tool, but a dotnet-prefixed executable with this
name could not be found on the PATH.Common causes
Local tools not restored
A dotnet-tools.json manifest lists the tool, but dotnet tool restore was never run in CI, so the tool binary is not present.
Tool not in the manifest or not on PATH
A tool meant to be global was never installed, or a typo in the command means no dotnet-<name> executable resolves.
How to fix it
Restore local tools before using them
Run dotnet tool restore so the manifest’s tools are installed for the repo.
dotnet tool restore
dotnet ef database updateAdd the tool to the manifest
If the tool is not yet declared, install it into the local manifest so CI can restore it.
dotnet new tool-manifest # if no .config/dotnet-tools.json yet
dotnet tool install dotnet-efHow to prevent it
- Commit
.config/dotnet-tools.jsonand rundotnet tool restoreearly in CI. - Declare every tool the pipeline uses in the local manifest.
- Verify the exact
dotnet <tool>command name matches the installed tool.