diff --git a/README.md b/README.md index d55379f1a..8f003ef11 100644 --- a/README.md +++ b/README.md @@ -309,6 +309,56 @@ Like with Rust, you can then inspect the output binary: wasm-tools component wit ./my-component.wasm ``` +### Guest C# + +To generate the bindings: + +``` +wit-bindgen c-sharp -w command -r native-aot --generate-stub wit/ +``` + +Now you create a c# project file: + +``` +dotnet new console -o MyApp +cd MyApp +dotnet new nugetconfig +``` + +In the `nuget.config` after ``make sure you have: + +``` + + +``` + +In the MyApp.csproj add the following to the property group: + +``` +wasi-wasm +false +true +true +true +true +path/to/wasi-sdk +``` + +Add the native-aot compiler (substitute `win-x64` for `linux-x64` on Linux): + +``` +dotnet add package Microsoft.DotNet.ILCompiler.LLVM --prerelease +dotnet add package runtime.win-x64.Microsoft.DotNet.ILCompiler.LLVM --prerelease +``` + +Now you can build with: + +``` +dotnet publish +``` + +Checkout out [componentize-dotnet](https://github.com/bytecodealliance/componentize-dotnet) for a simplified experience. + ### Guest: Java Java bytecode can be compiled to WebAssembly using