{"record":{"id":"d397195a20e4ff68","repo":"clockworklabs/SpacetimeDB","slug":"unsupported-net-sdk-version-major-spacetimedb","errorCode":null,"errorMessage":"Unsupported .NET SDK version: {major}. SpacetimeDB requires .NET SDK 8.0 or 10.0.","messagePattern":"Unsupported \\.NET SDK version: (.+?)\\. SpacetimeDB requires \\.NET SDK 8\\.0 or 10\\.0\\.","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/cli/src/tasks/csharp.rs","lineNumber":16,"sourceCode":"use anyhow::Context;\nuse itertools::Itertools;\nuse std::collections::HashSet;\nuse std::ffi::OsString;\nuse std::fs;\nuse std::path::{Path, PathBuf};\n\npub(crate) fn parse_major_version(version: &str) -> Option<u8> {\n    version.split('.').next()?.parse::<u8>().ok()\n}\n\nfn dotnet_global_json(major: u8) -> anyhow::Result<String> {\n    match major {\n        8 => Ok(r#\"{\"sdk\":{\"version\":\"8.0.100\",\"rollForward\":\"latestFeature\"}}\"#.to_string()),\n        10 => Ok(r#\"{\"sdk\":{\"version\":\"10.0.100\",\"rollForward\":\"latestMinor\"}}\"#.to_string()),\n        _ => anyhow::bail!(\"Unsupported .NET SDK version: {major}. SpacetimeDB requires .NET SDK 8.0 or 10.0.\"),\n    }\n}\n\n#[derive(Debug)]\nstruct CsprojTargetFrameworks {\n    path: PathBuf,\n    majors: Vec<u8>,\n}\n\nimpl CsprojTargetFrameworks {\n    fn single_major(&self) -> Option<u8> {\n        (self.majors.len() == 1).then_some(self.majors[0])\n    }\n}\n\n/// Read the target framework major versions directly from the project's `.csproj` file.\n/// Returns `net8.0`, `net10.0`, etc. from both `<TargetFramework>` and `<TargetFrameworks>`.\n/// Multi-target projects do not imply a single selected SDK version; callers should use a","sourceCodeStart":1,"sourceCodeEnd":34,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/524b4487d949b61a07d4f39c862d1290259dfd20/crates/cli/src/tasks/csharp.rs#L1-L34","documentation":"When generating a `global.json` for a C# module build, `dotnet_global_json(major)` only accepts .NET SDK majors 8 (pinning `8.0.100`, `rollForward: latestFeature`) and 10 (`10.0.100`, `rollForward: latestMinor`). Any other major — parsed from the project's csproj TargetFrameworks or SDK resolution — bails with this error listing the supported versions.","triggerScenarios":"A C# module whose `.csproj` targets `net6.0`, `net7.0`, or `net9.0` (anything outside net8.0/net10.0), or an SDK-pinning setting that resolves to a different major, when running `spacetime build`/`publish` on it.","commonSituations":"Porting an existing C# project that targeted an older framework; machines with only .NET 9 installed (between the supported majors); templates or tutorials using unsupported TargetFramework values; SDK pinning via a hand-written global.json conflicting with the CLI's supported set.","solutions":["Change the module's TargetFramework to `net8.0` (or `net10.0`) and rebuild","Install the matching .NET SDK (8.0 or 10.0) so the pinned version in the generated global.json can resolve","Remove conflicting SDK pins from any checked-in global.json so the CLI-generated one applies","If multiple frameworks are targeted, ensure the single-major case resolves to 8 or 10 (the code only auto-selects when exactly one major is present)"],"exampleFix":"<!-- before -->\n<TargetFramework>net9.0</TargetFramework>\n<!-- after -->\n<TargetFramework>net8.0</TargetFramework>","handlingStrategy":"validation","validationCode":"# Check the module's target framework before building\ngrep -qE '<TargetFramework>net(8|10)\\.0</TargetFramework>' proj/*.csproj || echo 'unsupported TFN: use net8.0 or net10.0'","typeGuard":"// Parse supported majors before invoking the build (Rust-ish pseudocode)\nfn supported_major(tf: &str) -> bool { matches!(tf, \"net8.0\" | \"net10.0\") }","tryCatchPattern":null,"preventionTips":["Standardize C# modules on net8.0 (or net10.0) TargetFramework","Install the SDK major you target so the generated global.json pin resolves","When targeting multiple frameworks, remember only a single major auto-selects cleanly — keep it in the supported set"],"tags":["spacetimedb","csharp","dotnet","sdk-version","version-conflict"],"backgroundTag":"unsupported-sdk-version","analyzedSha":"524b4487d949b61a07d4f39c862d1290259dfd20","analyzedAt":"2026-08-16T23:58:54.611Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}