clockworklabs/SpacetimeDB · error · anyhow::Error
The selected C# build path requires the .NET {desired_sdk_ma
Error message
The selected C# build path requires the .NET {desired_sdk_major} SDK, but the active SDK is .NET {active}.
Update {} to select the .NET {desired_sdk_major} SDK, or run `spacetime init --dotnet-version {desired_sdk_major}` to create a project configured for this SDK.
Expected global.json contents:
{} What it means
Error "The selected C# build path requires the .NET {desired_sdk_major} SDK, but the active SDK is .NET {active}. Update {} to select the .NET {desired_sdk_major} SDK, or run `spacetime init --dotnet-version {desired_sdk_major}` to create a project configured for this SDK. Expected global.json contents: {}" thrown in clockworklabs/SpacetimeDB.
Source
Thrown at crates/cli/src/tasks/csharp.rs:261
.unwrap_or_else(|| "<unknown>".to_string());
anyhow::bail!(
"Unsupported .NET SDK version: {}. SpacetimeDB requires .NET SDK 8.0 or 10.0.\n\
If 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.",
selected_version
);
}
};
let desired_sdk_major = match build_path {
CsharpBuildPath::Net8Jit | CsharpBuildPath::Net8Aot => 8,
CsharpBuildPath::Net10Aot => 10,
};
let active_sdk_major = dotnet_version_str.as_deref().and_then(parse_major_version);
if active_sdk_major != Some(desired_sdk_major) {
let active = dotnet_version_str.as_deref().map(str::trim).unwrap_or("<unknown>");
anyhow::bail!(
"The selected C# build path requires the .NET {desired_sdk_major} SDK, but the active SDK is .NET {active}.\n\
Update {} to select the .NET {desired_sdk_major} SDK, or run `spacetime init --dotnet-version {desired_sdk_major}` to create a project configured for this SDK.\n\
Expected global.json contents:\n{}",
project_path.join("global.json").display(),
dotnet_global_json(desired_sdk_major)?
);
}
// Manage the EXPERIMENTAL_WASM_AOT environment variable for MSBuild.
// - Net8Aot / Net10Aot: must SET it — the ILCompiler.LLVM.targets import in
// SpacetimeDB.Runtime.targets is gated on this env var. Without it, the NativeAOT
// toolchain is not activated and dotnet produces managed DLLs instead of a .wasm.
// - Net8Jit: must UNSET it — prevents MSBuild from incorrectly enabling NativeAOT mode
// when the env var is set globally (e.g., in CI).
match &build_path {
CsharpBuildPath::Net8Aot | CsharpBuildPath::Net10Aot => {
// SAFETY: We are single-threaded at this point and no other code is reading
// this environment variable concurrently.View on GitHub (pinned to 524b4487d9)
When it happens
Trigger: Thrown at crates/cli/src/tasks/csharp.rs:261 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of clockworklabs/SpacetimeDB@524b4487d9 (2026-08-16).
Data as JSON: /api/errors/b92cea7902394afa.
Report an issue: GitHub.