This devcontainer is configured to provide you a DotNet SDK 8.0 and wasi-sdk 20.0.
Tested with Extism .NET PDK v1.0.3, Extism CLI v1.5.1.
-
Open this repo in devcontainer, e.g. using Github Codespaces. Type or copy/paste following commands to devcontainer's terminal.
-
Install the WASI workload:
dotnet workload install wasi-experimental
- Generate WASI-enabled .Net project:
dotnet new wasiconsole -o HTTPRequestingPlugin
cd
into that project's directory:
cd HTTPRequestingPlugin
- Add Extism PDK dependency to project:
dotnet add package Extism.Pdk
- Copy HTTP example source code into project's folder to replace a generated one:
cp ../Program.cs .
- Compile the example:
dotnet build
Build process creates 25M-sized HTTPRequestingPlugin/bin/Debug/net8.0/wasi-wasm/AppBundle/HTTPRequestingPlugin.wasm
bundle.
For testing purposes, you can invoke functions from Extism plugins with Extism CLI.
- Install
Extism CLI
from Github releases:
wget https://github.com/extism/cli/releases/download/v1.5.1/extism-v1.5.1-linux-amd64.tar.gz -O /tmp/extism.tar.gz
tar -xzf /tmp/extism.tar.gz -C /tmp ; mv /tmp/extism .
And now you have extism
binary in current folder.
- Run default function (it's
_start
) from extism plugin with CLI, allowing outbound connections to all hosts:
./extism call ./bin/Debug/net8.0/wasi-wasm/AppBundle/HTTPRequestingPlugin.wasm _start --allow-host '*' --wasi
Perform your own experiments if desired.
This devcontainer is based on dev-wasm/dev-wasm-dotnet.
Created for (wannabe-awesome) list