Skip to main content
Wasmtime package icon

Wasmtime

v50.0.1Latest Stable
net10.0net8.0.NETStandard2.0.NETStandard2.1

A .NET embedding of Wasmtime. Wasmtime is a standalone runtime for WebAssembly, using the Cranelift JIT compiler. The .NET embedding of Wasmtime enables .NET code to instantiate WebAssembly modules and to interact with them in-process.

Published
Nov 6, 2026
18d ago
Total Downloads
2.4M
2,403,155

Install

dotnet add package Wasmtime --version 50.0.1
ProductVersions
.NET
net10.0net8.0
.NET Standard
netstandard2.0netstandard2.1

README

Installation

You can add a package reference with the .NET SDK:

$ dotnet add package wasmtime

Introduction

For this introduction, we'll be using a simple WebAssembly module that imports a hello function and exports a run function:

(module
  (func $hello (import "" "hello"))
  (func (export "run") (call $hello))
)

To use this module from .NET, create a new console project:

$ mkdir wasmintro
$ cd wasmintro
$ dotnet new console

Next, add a reference to the Wasmtime package:

$ dotnet add package wasmtime

Replace the contents of Program.cs with the following code:

using System;
using Wasmtime;

using var engine = new Engine();

using var module = Module.FromText(
    engine,
    "hello",
    "(module (func $hello (import \"\" \"hello\")) (func (export \"run\") (call $hello)))"
);

using var linker = new Linker(engine);
using var store = new Store(engine);

linker.Define(
    "",
    "hello",
    Function.FromCallback(store, () => Console.WriteLine("Hello from C#!"))
);

var instance = linker.Instantiate(store, module);
var run = instance.GetAction("run")!;
run();

An Engine is created and then a WebAssembly module is loaded from a string in WebAssembly text format.

A Linker defines a function called hello that simply prints a hello message.

The module is instantiated and the instance's run export is invoked.

To run the application, simply use dotnet:

$ dotnet run

This should print Hello from C#!.

Changes from Previous Version

No structural changes between v48.0.2 and v50.0.1.

Adoption Assessment

Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.

Compatibility metadata lists 4 target frameworks; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.