clockworklabs/SpacetimeDB · error · anyhow::Error

Looks like your project is using the deprecated .NET 7.0…

Error message

Looks like your project is using the deprecated .NET 7.0 WebAssembly bindings.
Please migrate your project to the new .NET 8.0 template and delete the folders: bin, bin~, obj, obj~

What it means

After `dotnet publish` succeeds, the CLI checks for stale artifacts of the retired .NET 7 WASM path: bin{,~}/{Debug|Release}/net7.0/StdbModule.wasm (the tilde variants exist because some tooling renames bin to bin~). Finding one means the project still carries the deprecated .NET 7.0 WebAssembly bindings, so the output cannot be trusted and the CLI refuses to proceed.

Solutions

  1. Migrate the project to the current .NET 8+ template (re-run `spacetime init` and move sources, or update package references and TFM).
  2. Delete bin, bin~, obj, obj~ exactly as the message instructs, then rebuild.
  3. Verify the csproj targets net8.0/net10.0, not net7.0.

Example fix

# before: old project still on net7.0
spacetime build
# after
rm -rf bin bin~ obj obj~
# update csproj: <TargetFramework>net8.0</TargetFramework>
spacetime build
Defensive patterns

Strategy: validation

Validate before calling

# Guard before building: reject .NET 7 targets and stale artifacts
 grep -q 'net7.0' "$PROJECT"/*.csproj && { echo "migrate csproj off net7.0" >&2; exit 1; }
ls "$PROJECT"/bin*/{Debug,Release}/net7.0/StdbModule.wasm 2>/dev/null && { echo "stale .NET 7 output; rm -rf bin bin~ obj obj~" >&2; exit 1; }
spacetime build

Prevention

When it happens

Trigger: `spacetime build`/`spacetime publish` on a C# module created from the old .NET 7 template, or one with leftover net7.0 build outputs, using a current SpacetimeDB CLI.

Common situations: Upgrading the CLI/toolchain on an old project without cleaning; bin~ backups kept alive by editors, sync, or backup tools; migrating sources into a new template but copying old bin/obj folders along.

Related errors


AI-assisted analysis of clockworklabs/SpacetimeDB@9e0d92412f (2026-08-20). Data as JSON: /api/errors/74b4700654b49a8f. Report an issue: GitHub.

Appendix: source

Thrown at crates/cli/src/tasks/csharp.rs:433

        target_framework.into(),
        "-v".into(),
        "quiet".into(),
    ]);
    if matches!(build_path, CsharpBuildPath::Net8Aot | CsharpBuildPath::Net8Jit) {
        publish_args.push("--no-restore".into());
        publish_args.push("--force".into());
        publish_args.push(format!("-p:{target_frameworks_override}").into());
    }
    duct::cmd("dotnet", publish_args).dir(project_path).run()?;

    // check for the old .NET 7 path for projects that haven't migrated yet
    let bad_output_paths = [
        project_path.join(format!("bin/{config_name}/net7.0/StdbModule.wasm")),
        // for some reason there is sometimes a tilde here?
        project_path.join(format!("bin~/{config_name}/net7.0/StdbModule.wasm")),
    ];
    if bad_output_paths.iter().any(|p| p.exists()) {
        anyhow::bail!(concat!(
            "Looks like your project is using the deprecated .NET 7.0 WebAssembly bindings.\n",
            "Please migrate your project to the new .NET 8.0 template and delete the folders: bin, bin~, obj, obj~"
        ));
    }
    let possible_output_paths = [
        // Standard publish output paths (JIT and some AOT builds)
        project_path.join(format!(
            "bin/{config_name}/{target_framework}/wasi-wasm/{subdir}/StdbModule.wasm"
        )),
        project_path.join(format!(
            "bin~/{config_name}/{target_framework}/wasi-wasm/{subdir}/StdbModule.wasm"
        )),
        // NativeAOT-LLVM outputs to 'native' subdirectory instead of 'publish'
        project_path.join(format!(
            "bin/{config_name}/{target_framework}/wasi-wasm/{subdir}/StdbModule.wasm"
        )),
        project_path.join(format!(
            "bin~/{config_name}/{target_framework}/wasi-wasm/{subdir}/StdbModule.wasm"

View on GitHub (pinned to 9e0d92412f)