{"id":29419874,"url":"https://github.com/bytecodealliance/wasmtime-dotnet","last_synced_at":"2025-07-12T01:13:15.031Z","repository":{"id":37890972,"uuid":"252254041","full_name":"bytecodealliance/wasmtime-dotnet","owner":"bytecodealliance","description":".NET embedding of Wasmtime https://bytecodealliance.github.io/wasmtime-dotnet/","archived":false,"fork":false,"pushed_at":"2025-07-11T02:49:58.000Z","size":2029,"stargazers_count":451,"open_issues_count":27,"forks_count":53,"subscribers_count":20,"default_branch":"main","last_synced_at":"2025-07-12T00:44:56.652Z","etag":null,"topics":["dotnet","wasmtime","webassembly"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bytecodealliance.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-01T18:21:12.000Z","updated_at":"2025-07-11T12:55:52.000Z","dependencies_parsed_at":"2024-04-07T20:28:44.525Z","dependency_job_id":"d20859f9-98c8-4275-92a4-5d11a63299d6","html_url":"https://github.com/bytecodealliance/wasmtime-dotnet","commit_stats":null,"previous_names":[],"tags_count":75,"template":false,"template_full_name":null,"purl":"pkg:github/bytecodealliance/wasmtime-dotnet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytecodealliance%2Fwasmtime-dotnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytecodealliance%2Fwasmtime-dotnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytecodealliance%2Fwasmtime-dotnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytecodealliance%2Fwasmtime-dotnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bytecodealliance","download_url":"https://codeload.github.com/bytecodealliance/wasmtime-dotnet/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytecodealliance%2Fwasmtime-dotnet/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264922908,"owners_count":23683705,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dotnet","wasmtime","webassembly"],"created_at":"2025-07-12T01:13:12.240Z","updated_at":"2025-07-12T01:13:15.024Z","avatar_url":"https://github.com/bytecodealliance.png","language":"C#","readme":"\u003cdiv align=\"center\"\u003e\n  \u003ch1\u003e\u003ccode\u003ewasmtime-dotnet\u003c/code\u003e\u003c/h1\u003e\n\n  \u003cp\u003e\n    \u003cstrong\u003e.NET embedding of\n    \u003ca href=\"https://github.com/bytecodealliance/wasmtime\"\u003eWasmtime\u003c/a\u003e\u003c/strong\u003e\n  \u003c/p\u003e\n\n  \u003cstrong\u003eA \u003ca href=\"https://bytecodealliance.org/\"\u003eBytecode Alliance\u003c/a\u003e project\u003c/strong\u003e\n\n  \u003cp\u003e\n    \u003ca href=\"https://github.com/bytecodealliance/wasmtime-dotnet/actions/workflows/main.yml\"\u003e\n      \u003cimg src=\"https://github.com/bytecodealliance/wasmtime-dotnet/actions/workflows/main.yml/badge.svg\" alt=\"CI status\"/\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://www.nuget.org/packages/Wasmtime\"\u003e\n      \u003cimg src=\"https://img.shields.io/nuget/v/wasmtime\" alt=\"Latest Version\"/\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://bytecodealliance.github.io/wasmtime-dotnet/\"\u003e\n      \u003cimg src=\"https://img.shields.io/badge/docs-main-green\" alt=\"Documentation\"/\u003e\n    \u003c/a\u003e\n  \u003c/p\u003e\n\n\u003c/div\u003e\n\n## Installation\n\nYou can add a package reference with the [.NET SDK](https://dotnet.microsoft.com/):\n\n```text\n$ dotnet add package wasmtime\n```\n\n## Introduction\n\nFor this introduction, we'll be using a simple WebAssembly module that imports\na `hello` function and exports a `run` function:\n\n```wat\n(module\n  (func $hello (import \"\" \"hello\"))\n  (func (export \"run\") (call $hello))\n)\n```\n\nTo use this module from .NET, create a new console project:\n\n```\n$ mkdir wasmintro\n$ cd wasmintro\n$ dotnet new console\n```\n\nNext, add a reference to the [Wasmtime package](https://www.nuget.org/packages/Wasmtime):\n\n```\n$ dotnet add package wasmtime\n```\n\nReplace the contents of `Program.cs` with the following code:\n\n```c#\nusing System;\nusing Wasmtime;\n\nusing var engine = new Engine();\n\nusing var module = Module.FromText(\n    engine,\n    \"hello\",\n    \"(module (func $hello (import \\\"\\\" \\\"hello\\\")) (func (export \\\"run\\\") (call $hello)))\"\n);\n\nusing var linker = new Linker(engine);\nusing var store = new Store(engine);\n\nlinker.Define(\n    \"\",\n    \"hello\",\n    Function.FromCallback(store, () =\u003e Console.WriteLine(\"Hello from C#!\"))\n);\n\nvar instance = linker.Instantiate(store, module);\nvar run = instance.GetAction(\"run\")!;\nrun();\n```\n\nAn `Engine` is created and then a WebAssembly module is loaded from a string in\nWebAssembly text format.\n\nA `Linker` defines a function called `hello` that simply prints a hello message.\n\nThe module is instantiated and the instance's `run` export is invoked.\n\nTo run the application, simply use `dotnet`:\n\n```\n$ dotnet run\n```\n\nThis should print `Hello from C#!`.\n\n## Contributing\n\n### Building\n\nUse `dotnet` to build the repository:\n\n```\n$ dotnet build Wasmtime.sln\n```\n\nThis will download the latest development snapshot of Wasmtime for your\nplatform.\n\n### Testing\n\nUse `dotnet` to run the unit tests:\n\n```\n$ dotnet test Wasmtime.sln\n```\n\n### Creating the NuGet package\n\nUse `dotnet` to create a NuGet package:\n\n```\n$ cd src\n$ dotnet pack Wasmtime.sln -c Release /p:Packing=true\n```\n\nThis will create a `.nupkg` file in `src/bin/Release`.\n\nBy default, local builds will use a `-dev` suffix for the package to\ndifferentiate between official packages and development packages.\n\n### Updating Wasmtime for a release\n\nTo update the Wasmtime library used for a new release, change `WasmtimeVersion`\nin `Directory.Build.props`:\n\n```xml\n\u003cWasmtimeVersion Condition=\"'$(WasmtimeVersion)'==''\"\u003e$VERSION\u003c/WasmtimeVersion\u003e\n```\n\n### Publishing the Wasmtime .NET NuGet package\n\nGitHub actions is used to automatically publish a package to NuGet when a tag\nis pushed to the repository.\n\nTo publish a new release, create a release in GitHub and add the relevant\nrelease notes.\n\nUse a tag of the format `v$VERSION` where `$VERSION` matches the Wasmtime\nversion used by the .NET package; ensure the tagged commit matches the last\ncommit to make for the release.\n\nWhen the release is published on GitHub, an action should automatically start\nto build and publish the package to NuGet.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbytecodealliance%2Fwasmtime-dotnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbytecodealliance%2Fwasmtime-dotnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbytecodealliance%2Fwasmtime-dotnet/lists"}