# dotnet "A compatible .NET SDK was not found" in CI

> Fix "A compatible .NET SDK was not found" / "command not found: dotnet" in CI when no SDK is installed or it is not on PATH. Install the SDK and verify it resolves.

Source: https://latchkey.dev/learn/dotnet/sdk-not-found-no-global-json  
Updated: 2026-06-25

The runner has no usable .NET SDK on PATH - either none is installed, only a runtime is present, or the host cannot find one. `dotnet build` cannot proceed without an SDK.

## Diagnose it: SDK version and restore

```Terminal
dotnet --info
cat global.json 2>/dev/null
dotnet restore --verbosity normal
dotnet build --no-restore
```

> Pin the SDK in `global.json` and install exactly that version. A floating SDK makes a runner image update a build break on unchanged code.

## FAQ

### What causes dotnet "A compatible .NET SDK was not found" in CI?

There are 2 common causes: no sdk installed on the runner and dotnet is not on path. A minimal image may ship only the .NET runtime (enough to run apps) but not the SDK needed to build them, or nothing at all.

### How do I fix dotnet "A compatible .NET SDK was not found" in CI?

There are 3 fixes depending on which cause you have: install the sdk with setup-dotnet, use the official sdk image in containers, and verify the install and path. Work through them in order, since the first is the most common.

### What does dotnet "A compatible .NET SDK was not found" in CI actually mean?

A dotnet command fails because there is no compatible SDK, or the shell reports dotnet: command not found.

### How do I stop dotnet "A compatible .NET SDK was not found" in CI happening again?

Always install the SDK explicitly in CI rather than relying on the image default. The prevention section lists 3 changes that keep it from recurring.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
