Binaryen.NET
0.1.1-alpha
This is a prerelease version of Binaryen.NET.
dotnet add package Binaryen.NET --version 0.1.1-alpha
NuGet\Install-Package Binaryen.NET -Version 0.1.1-alpha
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="Binaryen.NET" Version="0.1.1-alpha" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Binaryen.NET" Version="0.1.1-alpha" />
<PackageReference Include="Binaryen.NET" />
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 Binaryen.NET --version 0.1.1-alpha
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Binaryen.NET, 0.1.1-alpha"
#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 Binaryen.NET@0.1.1-alpha
#: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=Binaryen.NET&version=0.1.1-alpha&prerelease
#tool nuget:?package=Binaryen.NET&version=0.1.1-alpha&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Binaryen.NET
C# Bindings for the Binaryen WebAssembly toolchain.
Binaryen.NET is currently a prerelease package. If you notice missing features or have ideas for improvements, contributions are welcome!
Building
Ensure all Git submodules are up to date:
git submodule update --init --recursive
- If you only changed C# code: The project automatically uses the pre-built native binaries from
runtimes/
, no manual compilation is needed. - If you updated Binaryen itself: Rebuild Binaryen as a shared library, then place the compiled binaries for each target runtime into the
runtimes/
folder.
You can build the C# project by running:
dotnet build
from the directory containing Binaryen.NET.sln
.
To build or update the native Binaryen library (libbinaryen
), follow the instructions in the Binaryen repository.
Samples
Generating IR → WAT
using (var module = new BinaryenModule())
{
// Create a simple function body with a single NOP instruction
var body = BinaryenExpression.Nop(module);
// Add a function with no parameters, no return type, and no locals
module.AddFunction(
name: "TestMethod",
paramTypes: Array.Empty<BinaryenType>(),
resultType: BinaryenType.None,
localTypes: Array.Empty<BinaryenType>(),
body: body);
// Emit WAT
Console.WriteLine(module.ToText());
}
Web Assembly Text (WAT) Output:
(module
(type $0 (func))
(func $TestMethod
(nop)
)
)
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. 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.
-
net9.0
- No dependencies.
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 |
---|---|---|
0.1.1-alpha | 133 | 9/4/2025 |
0.1.0-alpha | 126 | 9/3/2025 |