Using the .NET Host SDK
Check your installation
For Mac and Linux users, please be sure you've installed Extism before continuing with this guide. This step is not required for Windows users as the native package is bundled with the Extism runtime DLL.
1. Install the NuGet Package
Install via NuGet:
dotnet add package Extism.Sdk
Windows Support
We provide a native package for Windows. You can install with:
dotnet add package Extism.runtime.win-64
2. Import the library and use the APIs
Count Vowels Plugin
code.wasm
in this example is our example plugin that counts vowels. If you want to run this, download it first and set the path:
curl https://raw.githubusercontent.com/extism/extism/main/wasm/code.wasm > code.wasm
Program.cs
using Extism.Sdk.Native;
using System.Text;
var wasm = await File.ReadAllBytesAsync("code.wasm");
using var plugin = Plugin.Create(wasm, withWasi: true);
var output = Encoding.UTF8.GetString(
plugin.CallFunction("count_vowels", Encoding.UTF8.GetBytes("Hello World!"))
);
Console.WriteLine(output); // prints {"count": 3}
Need help?
If you've encountered a bug or think something is missing, please open an issue on the Extism GitHub repository.
There is an active community on Discord where the project maintainers and users can help you. Come hang out!