{"record":{"id":"a070ee8b4ee2924e","repo":"clockworklabs/SpacetimeDB","slug":"unsupported-net-sdk-version-spacetimedb-requ","errorCode":null,"errorMessage":"Unsupported .NET SDK version: {}. SpacetimeDB requires .NET SDK 8.0 or 10.0.\nIf you have multiple versions installed, configure your project using https://learn.microsoft.com/en-us/dotnet/core/tools/global-json, or use --dotnet-version to specify the target version explicitly.","messagePattern":"Unsupported \\.NET SDK version: (.+?)\\. SpacetimeDB requires \\.NET SDK 8\\.0 or 10\\.0\\.\nIf you have multiple versions installed, configure your project using https://learn\\.microsoft\\.com/en-us/dotnet/core/tools/global-json, or use --dotnet-version to specify the target version explicitly\\.","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/cli/src/tasks/csharp.rs","lineNumber":246,"sourceCode":"    let build_path = match (dotnet_major, native_aot_flag) {\n        // .NET 10: always use NativeAOT-LLVM, no flag needed.\n        (Some(10), _) => {\n            if native_aot_flag {\n                println!(\"Note: --native-aot is not needed with .NET 10 (NativeAOT-LLVM is used automatically).\");\n            }\n            CsharpBuildPath::Net10Aot\n        }\n        // .NET 8 with --native-aot: use NativeAOT-LLVM with .NET 8 ILCompiler packages.\n        (Some(8), true) => CsharpBuildPath::Net8Aot,\n        // .NET 8 without flag: use the existing wasi-experimental JIT path.\n        (Some(8), false) => CsharpBuildPath::Net8Jit,\n        // Unsupported version.\n        _ => {\n            let selected_version = dotnet_major\n                .map(|v| v.to_string())\n                .or_else(|| dotnet_version_str.clone())\n                .unwrap_or_else(|| \"<unknown>\".to_string());\n            anyhow::bail!(\n                \"Unsupported .NET SDK version: {}. SpacetimeDB requires .NET SDK 8.0 or 10.0.\\n\\\n                 If you have multiple versions installed, configure your project using \\\n                 https://learn.microsoft.com/en-us/dotnet/core/tools/global-json, \\\n                 or use --dotnet-version to specify the target version explicitly.\",\n                selected_version\n            );\n        }\n    };\n\n    let desired_sdk_major = match build_path {\n        CsharpBuildPath::Net8Jit | CsharpBuildPath::Net8Aot => 8,\n        CsharpBuildPath::Net10Aot => 10,\n    };\n    if matches!(build_path, CsharpBuildPath::Net8Aot | CsharpBuildPath::Net10Aot)\n        && nativeaot_unsupported_on_host(std::env::consts::OS, Some(desired_sdk_major))\n    {\n        anyhow::bail!(NATIVEAOT_UNSUPPORTED_MESSAGE);\n    }","sourceCodeStart":228,"sourceCodeEnd":264,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/9e0d92412ff2248f401a8ad12d535f2b5ac30912/crates/cli/src/tasks/csharp.rs#L228-L264","documentation":"After resolving the effective .NET major (resolution order: --dotnet-version CLI flag, then global.json-selected SDK, then a single <TargetFramework> in the csproj, then the .NET 10 default), the CLI maps (major, native_aot) to a build path: 10 -> NativeAOT-LLVM, 8+AOT, 8+JIT. Any other major (6, 7, 9, unresolvable) lands here; the message includes the selected version string (or <unknown>) plus remediation hints.","triggerScenarios":"`spacetime build` on a C# project whose resolved SDK major is not 8 or 10: a global.json in the project or cwd pinning 6/7/9, a csproj targeting net7.0 as the single TFM, or dotnet --version resolving to an unsupported release.","commonSituations":"Legacy .NET 7-era SpacetimeDB projects; machine-default SDK being a preview release picked up through a stray global.json; multi-target csprojs where no single major could be inferred and the fallback chain ended on an unsupported value.","solutions":["Pin a supported SDK with a global.json next to the project (the sibling error prints the exact 8.0.100/10.0.100 templates; MS docs link is in the message).","Pass `--dotnet-version 8` or `--dotnet-version 10` explicitly on the build/publish command.","Update the csproj <TargetFramework> to net8.0 or net10.0.","Migrate old .NET 7 template projects (see the companion 'deprecated .NET 7.0 WebAssembly bindings' error)."],"exampleFix":"# before\nspacetime build\n# after\nspacetime build --dotnet-version 8","handlingStrategy":"validation","validationCode":"# Fail fast before building if the resolved major is unsupported\nMAJOR=$(dotnet --version 2>/dev/null | cut -d. -f1)\ncase \"$MAJOR\" in 8|10|\"\") ;; *) echo \"unsupported .NET SDK $MAJOR (need 8 or 10)\" >&2; exit 1 ;; esac\nspacetime build","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Commit a project-level global.json pinning SDK 8 or 10 so machine defaults cannot leak in.","Set csproj TargetFramework to net8.0/net10.0 only.","Pass --dotnet-version explicitly in CI for deterministic toolchain selection."],"tags":["csharp","dotnet","sdk-version","build","toolchain"],"backgroundTag":"unsupported-sdk-version","analyzedSha":"9e0d92412ff2248f401a8ad12d535f2b5ac30912","analyzedAt":"2026-08-20T06:08:37.179Z","contentChangedAt":"2026-08-20T06:08:37.179Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}