Skip to content
Latchkey

MSBuild "MSB4236: The SDK Microsoft.NET.Sdk was not found"

MSBuild could not locate the Microsoft.NET.Sdk MSBuild SDK that an SDK-style project needs. Usually the build is using a standalone/old MSBuild (or no .NET SDK is on PATH) that has no knowledge of the project SDK.

What this error means

Build fails at the <Project Sdk="Microsoft.NET.Sdk"> line with MSB4236 saying the SDK could not be found. Common when invoking msbuild from Visual Studio Build Tools without the .NET SDK, or when no SDK is installed.

MSBuild output
error MSB4236: The SDK 'Microsoft.NET.Sdk' specified could not be found.

Common causes

No .NET SDK on PATH

SDK-style projects resolve Microsoft.NET.Sdk from an installed .NET SDK. If none is installed or dotnet is not on PATH, MSBuild cannot find it.

Using a standalone/old MSBuild

Invoking msbuild.exe from a Build Tools install without the .NET SDK component (or an MSBuild too old to know the SDK) fails to resolve the project SDK.

How to fix it

Build with the .NET SDK

Use dotnet build, which carries the matching MSBuild and SDK resolver.

.github/workflows/ci.yml
- uses: actions/setup-dotnet@v4
  with:
    dotnet-version: '8.0.x'
- run: dotnet build -c Release

Install the SDK component for MSBuild

  1. If you must use msbuild, install the .NET SDK so its SDK resolver is available.
  2. On Windows Build Tools, add the ".NET SDK" workload component.
  3. Confirm with dotnet --list-sdks that an SDK is present before building.

How to prevent it

  • Prefer dotnet build over standalone msbuild for SDK-style projects in CI.
  • Ensure a .NET SDK is installed and on PATH on the runner.
  • Pin the SDK version so the project SDK always resolves.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →