A standalone WebAssembly runtime built on the Cranelift code generator, with WASI support and embeddings for multiple languages.
zion-sati/NetWasm
A C# and .NET CIL to WebAssembly compiler with its own CoreLib, runtime and SDK, producing small standalone WASI Preview 2 components.
- Stars
- 233
- Forks
- 7
- Open issues
- 6
- Last commit
- 1 hour ago
What is it?
NetWasm compiles C# and .NET CIL directly to WebAssembly, using its own compiler, CoreLib, runtime and SDK rather than shipping the desktop CLR, Mono or application DLLs. The compiler works from the reachable program and links only the runtime support it needs, so the output is a self-contained WASI Preview 2 component that is run by a Wasm host such as Wasmtime, while the build itself uses the ordinary dotnet CLI.
The project targets developers who want small, sandboxed C# binaries, for example for serverless functions or browser modules. It offers three garbage collector strategies (Compact by default, NetWasmGC and Bump), publishes C# exports as typed JavaScript modules that can run in a Web Worker, and generates C# bindings from WIT. Support covers a defined subset of .NET: runtime reflection, dynamic, runtime assembly loading and managed threading are not included, and the project is pre-1.0.
Key features
- 01Compiles C# and .NET CIL directly to standalone WASI Preview 2 components.
- 02Links only reachable code and needed runtime support to keep binaries small.
- 03Offers Compact, NetWasmGC and Bump garbage collector strategies.
- 04Publishes C# exports as typed JavaScript modules, including Web Worker use.
- 05Generates C# bindings from WIT and supports static .a native interop.
- 06Builds and tests through the standard dotnet CLI.
Use cases
- Shipping small C# functions to a WebAssembly host or serverless runtime.
- Running C# logic inside a browser page or Web Worker as a typed JavaScript module.
- Building portable C# libraries that target both NetWasm and desktop .NET.
- Evaluating C# as a compact Wasm alternative to larger Blazor WebAssembly builds.
Quick start
- 1
Install the .NET SDK 10.0.303 or newer
- 2
Install the NetWasm project templates
dotnet new install NetWasm.Templates - 3
Create a new NetWasm app and run it
dotnet new netwasm-app -n HelloNetWasm - 4
Publish the app as a standalone WASI component
dotnet publish -c Release -o publish/local
Things to know
- NetWasm is pre-1.0, so source, package and ABI contracts may change between minor releases.
- Runtime reflection, dynamic, runtime assembly loading and managed threading are not supported.
- General file, directory, socket and subprocess APIs are not yet implemented.
- The published component needs a WebAssembly host such as Wasmtime to run.
Topics
FAQ
- What is NetWasm?
- A C# and .NET CIL to WebAssembly compiler with its own CoreLib, runtime and SDK, producing small standalone WASI Preview 2 components. NetWasm compiles C# and .NET CIL directly to WebAssembly, using its own compiler, CoreLib, runtime and SDK rather than shipping the desktop CLR, Mono or application DLLs. The compiler works from the reachable program and links only the runtime support it needs, so the output is a self-contained WASI Preview 2 component that is run by a Wasm host such as Wasmtime, while the build itself uses the ordinary dotnet CLI.
- Is NetWasm free to use? What license does it have?
- NetWasm is open source under the Other license. Check the license terms before using it in commercial products.
- Is NetWasm still maintained?
- Actively maintained. The last commit to NetWasm was on Oct 22, 2026.
- What can I use NetWasm for?
- Shipping small C# functions to a WebAssembly host or serverless runtime. Running C# logic inside a browser page or Web Worker as a typed JavaScript module. Building portable C# libraries that target both NetWasm and desktop .NET. Evaluating C# as a compact Wasm alternative to larger Blazor WebAssembly builds.
- How do I install NetWasm?
- Install the .NET SDK 10.0.303 or newer Install the NetWasm project templates: dotnet new install NetWasm.Templates Create a new NetWasm app and run it: dotnet new netwasm-app -n HelloNetWasm Publish the app as a standalone WASI component: dotnet publish -c Release -o publish/local
- Where can I get NetWasm?
- The source code and installation instructions are on GitHub: https://github.com/zion-sati/NetWasm
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A Go compiler built on LLVM that targets microcontrollers, WebAssembly (WASM/WASI), and command-line tools.
A experimental TypeScript and JavaScript compiler that turns programs into native executables or WebAssembly, without requiring Node.js at runtime.
A WebAssembly runtime and CLI for running apps and AI agent code in fast, lightweight, sandboxed environments.
A compiler toolchain that turns C and C++ code into WebAssembly so it can run in browsers, Node.js and other Wasm runtimes.
A TypeScript-like language and compiler that turns a typed subset of TypeScript into WebAssembly modules.