Skip to content
Latchkey

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.

Terminal
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.

Terminal
dotnet tool restore
dotnet ef database update

Add the tool to the manifest

If the tool is not yet declared, install it into the local manifest so CI can restore it.

Terminal
dotnet new tool-manifest   # if no .config/dotnet-tools.json yet
dotnet tool install dotnet-ef

How to prevent it

  • Commit .config/dotnet-tools.json and run dotnet tool restore early in CI.
  • Declare every tool the pipeline uses in the local manifest.
  • Verify the exact dotnet <tool> command name matches the installed tool.

Frequently asked questions

What causes ""the specified command ... was not found""?
A dotnet-tools.json manifest lists the tool, but dotnet tool restore was never run in CI, so the tool binary is not present.
How do I fix "the specified command ... was not found"?
Run dotnet tool restore so the manifest’s tools are installed for the repo.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card