Quick answer: The Godot version you’re running expects a specific .NET SDK. Install the matching SDK, delete .godot/mono/temp/bin + obj folders, and rebuild from Project → Tools → C#.

A C# project that worked yesterday now fails to build with “SDK not found” or a cryptic MSBuild error. Usually a Godot or SDK version mismatch.

Match the SDK

Each Godot 4.x release pins to a specific .NET SDK (currently .NET 8 / 9 for recent builds). Install that SDK from Microsoft and confirm with dotnet --list-sdks.

Clear Build Artifacts

# at project root
rm -rf .godot/mono
rm -rf bin obj

Stale build outputs from an older SDK confuse the next build. A clean rebuild from the editor regenerates them correctly.

Rebuild From the Editor

Project → Tools → C# → Create C# Solution (if missing) then Build. The editor invokes MSBuild with the right args; running dotnet build by hand can pick the wrong SDK.

Global.json Pin

For team projects, a global.json at the repo root pinning the SDK version stops “works on my machine” drift — everyone uses the same SDK regardless of what’s installed.

Verifying

The build succeeds with no MSBuild errors. The Output panel shows the SDK Godot picked — matches what you installed. Run the game; C# scripts load.

“SDK + Godot version + clean artifacts. Mismatch any of the three and MSBuild barks.”

Commit global.json. Every ‘dotnet not found’ bug on a teammate’s machine traces back to differing SDK versions otherwise.