SpacetimeDB.Runtime 2.2.0

Prefix Reserved
dotnet add package SpacetimeDB.Runtime --version 2.2.0
                    
NuGet\Install-Package SpacetimeDB.Runtime -Version 2.2.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SpacetimeDB.Runtime" Version="2.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SpacetimeDB.Runtime" Version="2.2.0" />
                    
Directory.Packages.props
<PackageReference Include="SpacetimeDB.Runtime" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SpacetimeDB.Runtime --version 2.2.0
                    
#r "nuget: SpacetimeDB.Runtime, 2.2.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SpacetimeDB.Runtime@2.2.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SpacetimeDB.Runtime&version=2.2.0
                    
Install as a Cake Addin
#tool nuget:?package=SpacetimeDB.Runtime&version=2.2.0
                    
Install as a Cake Tool

⚠️ Internal Project ⚠️

This project is intended for internal use only. It is not stable and may change without notice.

SpacetimeDB.Runtime

This project contains the runtime bindings for SpacetimeDB WebAssembly modules. See the C# module library reference for stable, user-facing documentation.

SpacetimeDB modules are compiled to WebAssembly modules that expose a specific interface; see the module ABI reference.

The runtime bindings are currently implementing via Wasi.Sdk package, which is a .NET implementation of the WASI standard. This is likely to change in the future.

While not really documented, it allows to build raw WebAssembly modules with custom bindings as well, which is what we're using here. The process is somewhat complicated, but here are the steps:

  • bindings.c declares raw C bindings to the SpacetimeDB FFI imports and marks them with attributes like __attribute__((import_module("spacetime"), import_name("_insert"))) that make them WebAssembly imports. (unfortunately, function name duplication is currently unavoidable)
  • bindings.c implements a bunch of Mono-compatible wrappers that convert between Mono types and raw types expected by the SpacetimeDB FFI and invoke corresponding raw bindings.
  • Runtime.cs declares corresponding functions with compatible signatures for Mono-compatible wrappers to attach to. It marks them all with [MethodImpl(MethodImplOptions.InternalCall)].
  • bindings.c attaches all those Mono-compatible wrappers to their C# declarations in a mono_stdb_attach_bindings function.
  • bindings.c adds FFI-compatible exports that search for a method by assembly name, namespace, class name and a method name in the Mono runtime and invoke it. Those exports are marked with attributes like __attribute__((export_name("__call_reducer__"))) so that they're exported from Wasm by the linker.
  • Finally, bindings.c implements no-op shims for all the WASI APIs so that they're linked internally and not attempted to be imported from the runtime itself.

The result is a WebAssembly module FFI-compatible with SpacetimeDB and with no WASI imports, which is what we need.

Regenerating RawModuleDef

To regenenerate the Autogen folder, run:

cargo run -p spacetimedb-codegen --example regen-csharp-moduledef

This folder contains the type definitions used to serialize the RawModuleDef that is returned by __describe_module__.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.2.0 495 5/1/2026
2.1.0 2,550 3/24/2026
2.0.4 863 3/11/2026
2.0.3 445 3/4/2026
2.0.2 710 2/26/2026
2.0.1 1,304 2/24/2026
2.0.0-rc1 128 2/20/2026
1.12.0 2,364 2/4/2026
1.11.2 1,463 1/9/2026
1.11.1 930 12/18/2025
1.11.0 938 12/9/2025
1.10.0 1,161 11/27/2025
1.9.0 1,117 11/21/2025
1.8.0 964 11/12/2025
1.7.0 1,155 11/3/2025
1.6.0 4,617 10/16/2025
1.5.0 7,596 10/1/2025
1.4.0 1,009 9/23/2025
1.3.0 2,343 8/1/2025
1.2.1 2,620 6/23/2025
Loading failed