![]() |
VOOZH | about |
dotnet add package WACS.WASI.Preview2.DependencyInjection --version 0.3.0
NuGet\Install-Package WACS.WASI.Preview2.DependencyInjection -Version 0.3.0
<PackageReference Include="WACS.WASI.Preview2.DependencyInjection" Version="0.3.0" />
<PackageVersion Include="WACS.WASI.Preview2.DependencyInjection" Version="0.3.0" />Directory.Packages.props
<PackageReference Include="WACS.WASI.Preview2.DependencyInjection" />Project file
paket add WACS.WASI.Preview2.DependencyInjection --version 0.3.0
#r "nuget: WACS.WASI.Preview2.DependencyInjection, 0.3.0"
#:package WACS.WASI.Preview2.DependencyInjection@0.3.0
#addin nuget:?package=WACS.WASI.Preview2.DependencyInjection&version=0.3.0Install as a Cake Addin
#tool nuget:?package=WACS.WASI.Preview2.DependencyInjection&version=0.3.0Install as a Cake Tool
Microsoft.Extensions.DependencyInjection extensions for
WACS.WASI.Preview2. One-call
registration of every WASI 0.2.3 subsystem default + a pre-wired Linker.
Component-mode WASI Preview 2 hosts assemble a lot of moving pieces — typed [WitSource]
interfaces per subsystem, the resource-handle registry, the Linker that fires every
*Bindings.BindToRuntime, the composite bundle that exposes Preview 2 + WASI.NN through one
CLR object. This package wires it all in idiomatic .NET DI form.
dotnet add package WACS.WASI.Preview2.DependencyInjection
WasiPreview2RuntimeScope (one-shot embedder)The simplest path: one disposable that owns the DI scope, fires every binding's
BindToRuntime, and resolves the composite bundle.
using Wacs.Core.Runtime;
using Wacs.WASI.Preview2.DependencyInjection;
var runtime = new WasmRuntime();
using var wasi = new WasiPreview2RuntimeScope(
runtime,
preopens: new[] { ("./models", "/models") });
// wasi.Bundle → composite hostBundle
// (Preview2 + WASI.NN forwarding when the
// WASI.NN.DependencyInjection sibling is on
// the load path)
// wasi.Resources → single resource registry across subsystems
// wasi.Runtime → runtime, with every wasi:* binding wired
// ... transpile the component, instantiate, invoke ...
WasiPreview2RuntimeScope is what wacs run --wasip2 uses internally. It auto-discovers
Wacs.WASI.NN.DependencyInjection when present and registers the
WasiPreview2NNBundle composite — no extra config when chaining wasi-nn alongside.
IServiceCollectionFor ASP.NET, generic-host worker services, or anywhere with an existing DI container:
using Microsoft.Extensions.DependencyInjection;
using Wacs.WASI.Preview2.DependencyInjection;
var services = new ServiceCollection();
services.AddWasiPreview2(); // every WASI 0.2.3 subsystem default registered
// Override individual subsystems via DI's normal TryAdd semantics:
services.AddSingleton<IOutgoingHandler>(_ =>
new HttpClientOutgoingHandler(new HttpClient { Timeout = ... }));
services.AddSingleton<IEnvironment>(_ =>
new SandboxedEnvironment(envVars: ..., args: ..., cwd: ...));
using var sp = services.BuildServiceProvider();
using var scope = sp.CreateScope();
var linker = scope.ServiceProvider.GetRequiredService<Linker>();
// linker.Runtime is the WasmRuntime with every wasi:* import bound
AddWasiPreview2(opts => opts.InstanceLifetime = ServiceLifetime.Scoped) is the default —
fits ASP.NET request-scoped wasm execution. Pass Transient for per-call construction or
Singleton for single-component apps.
When WACS.WASI.NN.DependencyInjection
is on the load path, the runtime scope auto-discovers it and registers the
WasiPreview2NNBundle composite that forwards both Preview 2 and WASI.NN [WitSource]
interface properties through one CLR object. The transpiler's direct-link IL casts to the
composite type at the import call site; this package's auto-detection guarantees the
expected type is present without any extra config.
cli / clocks / filesystem / http
/ io / random / socketsWasiPreview2Bundle (single-package) and WasiPreview2NNBundle (composite) bundle
typesWasiPreview2Resources — the canonical resource registry direct-link emit looks upWasiPreview2RuntimeScope — one-shot scope owning DI lifecycle, Linker resolution, and
composite-bundle discoverydocs/COMPONENT_CHAINING.md
— runtime requirements, host-package composition, end-to-end CLI / embedder examplesWACS.WASI.Preview2's
README for manual subsystem wiring (no DI), per-impl override patternsApache-2.0
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 netstandard2.1 is compatible. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 2 NuGet packages that depend on WACS.WASI.Preview2.DependencyInjection:
| Package | Downloads |
|---|---|
|
WACS.WASI.NN.DependencyInjection
Microsoft.Extensions.DependencyInjection extension methods for WACS.WASI.NN. Registers the WasiNNBundle that the transpiler's HostPackageResolver direct-links wasi:nn imports against — symmetric with WACS.WASI.Preview2.DependencyInjection. Tracks the wasi-nn proposal at WASI Phase 2 — the WIT surface may change as the proposal evolves. |
|
|
WACS.WASI.GFX.DependencyInjection
Microsoft.Extensions.DependencyInjection extension methods for WACS.WASI.GFX. Registers the WasiGfxBundle that the transpiler's HostPackageResolver will direct-link wasi-gfx imports against — symmetric with WACS.WASI.NN.DependencyInjection and WACS.WASI.Preview2.DependencyInjection. Preview: tracks the wasi-gfx proposal at WASI Phase 2 — the WIT surface may change as the proposal evolves. |
This package is not used by any popular GitHub repositories.