{"record":{"id":"833ad33633103503","repo":"clockworklabs/SpacetimeDB","slug":"could-not-find-stdbmodule-csproj-at","errorCode":null,"errorMessage":"Could not find StdbModule.csproj at {}","messagePattern":"Could not find StdbModule\\.csproj at (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/cli/src/subcommands/init.rs","lineNumber":1942,"sourceCode":"        .unwrap_or(false)\n}\n\n/// Adds NativeAOT-LLVM project configuration to an existing C# .csproj file and creates NuGet.Config.\n///\n/// The configuration differs depending on the target .NET version:\n///\n/// **.NET 8 AOT** (`--native-aot`): Keeps `net8.0` TFM and adds explicit ILCompiler.LLVM 8.0.0-*\n/// package references, gated on `EXPERIMENTAL_WASM_AOT=1`.\n///\n/// **.NET 10 AOT**: Replaces the TFM with `net10.0` directly (no conditional needed since the\n/// project is definitively targeting .NET 10). ILCompiler.LLVM refs are provided transitively\n/// by the SpacetimeDB.Runtime NuGet package.\n///\n/// Both paths need a NuGet.Config with the dotnet-experimental feed for ILCompiler.LLVM resolution.\nfn add_native_aot_packages_to_csproj(project_path: &Path, dotnet_major: Option<u8>) -> anyhow::Result<()> {\n    let csproj_path = project_path.join(\"StdbModule.csproj\");\n    if !csproj_path.exists() {\n        anyhow::bail!(\"Could not find StdbModule.csproj at {}\", csproj_path.display());\n    }\n\n    let content = std::fs::read_to_string(&csproj_path)?;\n\n    let new_content = if dotnet_major == Some(8) {\n        let has_net8_native_aot_refs =\n            csproj_has_package_reference(&content, \"Microsoft.DotNet.ILCompiler.LLVM\", \"8.0.0-*\")\n                && csproj_has_package_reference(\n                    &content,\n                    \"runtime.$(NETCoreSdkPortableRuntimeIdentifier).Microsoft.DotNet.ILCompiler.LLVM\",\n                    \"8.0.0-*\",\n                );\n\n        if has_net8_native_aot_refs {\n            content\n        } else {\n            // .NET 8 AOT: keep net8.0 TFM, add explicit ILCompiler.LLVM package references.\n            let native_aot_config = r#\"","sourceCodeStart":1924,"sourceCodeEnd":1960,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/fdd647dfac506d0967cc4492e9fce380706c94cb/crates/cli/src/subcommands/init.rs#L1924-L1960","documentation":"With --native-aot, init post-processes the C# module project expecting a file literally named StdbModule.csproj in the module directory. If generation produced a differently named csproj (renamed/absent) the AOT step bails before editing.","triggerScenarios":"--native-aot on a C# project whose csproj was renamed before init finished; a custom/forked template using a different csproj filename; running the AOT step against a non-C# or half-generated project layout.","commonSituations":"Team conventions renaming the module csproj; forked templates; scripts rerunning init steps out of order.","solutions":["Regenerate the project (`spacetime init --lang csharp`) and keep the default StdbModule.csproj name through the AOT step","If you must rename, rename after init completes, or update the forked template to emit StdbModule.csproj","Verify `spacetimedb/StdbModule.csproj` exists before rerunning with --native-aot"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"# verify the expected file exists before rerunning init with AOT\n[ -f spacetimedb/StdbModule.csproj ] && spacetime init . --server-only --native-aot || echo 'missing StdbModule.csproj'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep the module csproj named StdbModule.csproj until init finishes","Rename or restructure the csproj only after the full init pipeline completes"],"tags":["spacetime-init","native-aot","csharp","csproj","missing-file"],"backgroundTag":"missing-project-file","analyzedSha":"fdd647dfac506d0967cc4492e9fce380706c94cb","analyzedAt":"2026-08-20T06:08:37.179Z","contentChangedAt":"2026-08-20T06:08:37.179Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}