Why
An agent can verify new C# compiles without opening the Unity Editor, using dotnet build against a project file. Useful when no one is around to press Play.
The .NET 10 SDK Crash
On this machine, the default .NET SDK (10.0.401) crashes when compiling Unity's generated Assembly-CSharp.csproj, with the error "Your Windows doesn't fully support CET. Please install all available Windows updates." This is a Roslyn/Windows CET (shadow stack) incompatibility, not a project problem.
Fix: global.json in the project root pins the SDK to an older installed version (8.0.417), which doesn't hit this crash:
{
"sdk": {
"version": "8.0.417",
"rollForward": "latestMinor"
}
}
CompileCheck.csproj
Unity's own Assembly-CSharp.csproj is regenerated by the Editor and only lists files that existed at the last sync - it will not pick up new scripts written outside Unity. CompileCheck.csproj in the project root is a small hand-maintained sibling project for exactly this: it globs Assets\Scripts\Rokojori\**\*.cs and Assets\Scripts\Project\**\*.cs directly, referencing the same Unity DLLs, so it always covers whatever exists on disk.
To check the whole Rokojori/Project codebase compiles:
dotnet build CompileCheck.csproj
This only proves the code compiles against Unity's managed API surface - it does not run anything. It cannot catch runtime-only issues (missing scene references, inspector wiring, play-mode behaviour). Use the Unity Editor for that.