ARN

Microsoft .NET 7 bolsters WebAssembly support

Expanded WebAssembly support in .NET 7 allows developers to reuse .NET libraries from JavaScript or build new .NET-based apps that will run on Wasm.

Microsoft’s .NET 7 software development platform, due as a production release in November, improves support for running .NET on WebAssembly in JavaScript-based apps.

Developers can use the expanded WebAssembly support in .NET 7 to reuse .NET libraries from JavaScript or build new .NET-based apps. Featured as part of Microsoft’s effort is a rich JavaScript interop mechanism, according to a Microsoft blog post on September 26.

Microsoft hopes the new capabilities will spur developers to build better integration between the JavaScript ecosystem and .NET. Developers can use existing JavaScript libraries within existing frameworks such as Blazor or Uno, or use them directly. While WebAssembly backing in .NET 7 is the basis for Blazor WebAssembly apps, this support also can be used independently of Blazor.

Current JavaScript apps can use .NET’s expanded WebAssembly support to reuse .NET libraries from JavaScript or to build novel .NET-based apps and frameworks. Blazor WebAssembly apps can use the JavaScript interop mechanism to optimise interactions with JavaScript and the web platform.

Microsoft’s blog post details an example of the workings of JavaScript interop in .NET 7, creating a C# port of TodoMVC, a tool for selecting UI frameworks, based on the vanilla ECMAScript 6 version of JavaScript.

.NET 7 currently is in a release candidate stage of development. Microsoft noted that before .NET 7, developers performing low-level JavaScript interop in Blazor WebAssembly may have used undocumented APIs grouped in the MONO and BINDING JavaScript namespaces. While these APIs are still in .NET 7 for backward compatibility, developers should consider them deprecated.