欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

计划用于 .NET 8 的 WASI 推迟到 .NET 9

最编程 2024-07-16 09:18:08
...

本计划在 .NET 8 中推出的 WASI  已推迟到 .NET 9,请参阅 Github 上的 WASI 跟踪问题。 在.NET 8 Preview 4 开始支持生成与 WASI 兼容的 .wasm 文件,使用独立的 WebAssembly 运行时 Wasmtime CLI1 运行该文件。

去年的文章 在 .NET 7上使用 WASM 和 WASI 2介绍了 WebAssembly WASI的支持最早在Steve Sanderson 个人仓库 SteveSandersonMS/dotnet-wasi-sdk 开始引入,接着正式引入到 dotnet/dotnet-wasi-sdk, 目前这部分工作已经引入到dotnet/runtime 的WASI 跟踪问题 3。  Steve Sanderson 在Youtube视频 4解释了如何获得单个 wasm 文件,.NET 8 添加了一个新的“wasi-experimental”工作负载,取代了早期的 Wasi.Sdk。这是为服务器端 WebAssembly 方案提供 .NET 本机内置支持的一个步骤。他还展示了几个令人兴奋的使用示例。

鉴于WASI的字节码联盟 WebAssembly:面向开发人员的更新路线图5,因为WASI预览版2和3非常有可能会引入重大变化,这对于.NET 对WASI的支持非常有意义。WebAssembly(Wasm)生态系统正在转型。开发人员可以期待一个模块化、可虚拟化且强大的环境来构建应用程序、库和服务。

我们来看一看在.NET 8 下面如何使用WASI。

.NET SDK: .NET 8.0 RC1
dotnet cli :  .NET WebAssembly Build Tools
.NET workloads:
  • wasi-experimental
  • wasm-experimental
  • wasm-tools (来自 Visual Studio)
Wasmtime CLI: 通过MSI 安装了14.0 版本

示例程序参考:[wasiconsole-hello-world6]

相关链接:

  • 1Wasmtime CLI:https://github.com/BytecodeAlliance/wasmtime
  • 2在 .NET 7上使用 WASM 和 WASI :https://cloud.tencent.com/developer/article/2162541
  • 3WASI 跟踪问题 :https://github.com/dotnet/runtime/issues/65895
  • 4 Experiments with the new WASI workload in .NET 8 Preview 4:https://www.youtube.com/watch?v=gKX-cdqnb8I
  • 5WebAssembly:面向开发人员的更新路线图:https://bytecodealliance.org/articles/webassembly-the-updated-roadmap-for-developers
  • 6wasiconsole-hello-world:https://github.com/geffzhang/webassembly-experiments/tree/main/wasiconsole-hello-world

推荐阅读