Wasmtime 6.0.1

.NET 7.0 .NET Standard 2.1
There is a newer version of this package available.
See the version list below for details.
dotnet add package Wasmtime --version 6.0.1
NuGet\Install-Package Wasmtime -Version 6.0.1
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="Wasmtime" Version="6.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Wasmtime --version 6.0.1
#r "nuget: Wasmtime, 6.0.1"
#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.
// Install Wasmtime as a Cake Addin
#addin nuget:?package=Wasmtime&version=6.0.1

// Install Wasmtime as a Cake Tool
#tool nuget:?package=Wasmtime&version=6.0.1

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#!.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.1

    • No dependencies.
  • net7.0

    • No dependencies.

NuGet packages (7)

Showing the top 5 NuGet packages that depend on Wasmtime:

Package Downloads
Opa.Wasm

Call Open Policy Agent (OPA) policies in WASM (Web Assembly) from .NET

DevCycle.SDK.Server.Local

.NET Server Local Bucketing SDK for DevCycle

Deislabs.WAGI

Provides a configuration driven method to add WAGI modules as route endpoints to ASP.Net Core applications using WAGI.WARNING: WAGI is experimental. It is not considered production-grade by its developers, neither is it "supported" software..

DOPA

A .NET API for evaluating OPA policies compiled as WebAssembly modules.

DotNetIsolator

Package Description

GitHub repositories (2)

Showing the top 2 popular GitHub repositories that depend on Wasmtime:

Repository Stars
SteveSandersonMS/DotNetIsolator
A library for running isolated .NET runtimes inside .NET
bytecodealliance/wasmtime-demos
Demos for Wasmtime usage and WASI content
Version Downloads Last updated
9.0.3 39 6/2/2023
9.0.2 70 5/30/2023
9.0.1 219 5/22/2023
9.0.0 53 5/22/2023
8.0.1 1,033 4/27/2023
8.0.0 278 4/21/2023
7.0.1 101 4/27/2023
7.0.0 639 4/1/2023
6.0.2 110 4/27/2023
6.0.1 1,585 3/8/2023
6.0.0 605 2/27/2023
5.0.1 291 3/8/2023
5.0.0 10,821 1/25/2023
4.0.1 198 3/8/2023
4.0.0 259 1/25/2023
3.0.0 7,497 12/8/2022
2.0.2 668 11/10/2022
2.0.1 433 11/9/2022
2.0.0 301 11/9/2022
1.0.2 313 11/11/2022
1.0.1 316 11/9/2022
1.0.0 1,663 9/26/2022
0.40.0-preview1 2,471 8/29/2022
0.39.1-preview2 2,684 8/11/2022
0.39.1-preview1 97 8/10/2022
0.39.0-preview1 90 8/10/2022
0.38.1-preview1 1,424 6/29/2022
0.38.0-preview1 103 6/29/2022
0.37.0-preview1 789 6/14/2022
0.36.0-preview1 665 4/26/2022
0.35.2-preview1 1,545 4/5/2022
0.35.1-preview1 102 4/5/2022
0.35.0-preview1 338 3/9/2022
0.34.0-preview1 9,514 2/11/2022
0.33.0-preview2 16,245 1/25/2022
0.33.0-preview1 442 1/7/2022
0.32.1-preview1 117 1/7/2022
0.32.0-preview1 317 12/18/2021
0.31.0-preview1 7,487 11/1/2021
0.30.0-preview1 5,642 9/17/2021
0.29.0-preview1 626 8/6/2021
0.28.0-preview1 27,376 6/15/2021
0.27.0-preview1 841 5/22/2021
0.26.1-preview1 164 5/21/2021
0.26.0-preview1 524 4/20/2021
0.25.0-preview1 734 3/18/2021
0.24.0-preview1 224 3/18/2021
0.23.0-preview1 409 2/19/2021
0.22.1-preview1 1,959 1/19/2021
0.22.0-preview1 297 1/19/2021
0.21.0-preview1 421 1/14/2021
0.20.0-preview1 1,322 11/2/2020
0.19.0-preview1 1,418 7/24/2020
0.18.1-preview1 719 7/1/2020
0.18.0-preview1 506 6/30/2020
0.15.0-preview1 1,004 4/6/2020
0.12.0-preview1 697 2/26/2020
0.8.0-preview2 576 12/5/2019
0.8.0-preview1 440 11/23/2019
0.0.1-alpha1 452 10/2/2019

Update Wasmtime to 6.0.1.