WebAssembly tools, frameworks, and libraries for .NET Developers

WebAssembly provides a way to run code written in multiple languages on the web at near-native speed, with client apps running on the web that previously couldn’t have done so. This is why it’s gaining quick adoption and more awareness in the web community. Using the WebAssembly JavaScript APIs, you can load WebAssembly modules into a JavaScript app and share functionality between them. This blog post is a part of the Introduction to WebAssembly for .NET Developer Series on Uno Platform blogs For you as a .NET developer, this means you can write code in C# and run it in the browser. This can be libraries that you can compile into a WebAssembly module or an app built entirely using C#. Using .NET for client-side WebAssembly development offers advantages such as: – Leverage the existing .NET ecosystem of .NET libraries. – Benefit from .NET’s performance. – Stay productive with the same tools you use for Web or Desktop development on Windows, Linux, and macOS. – Build on a common set of languages, frameworks, and tools that are stable, feature-rich, and easy to use. In this post, I’ll share with you different tools and libraries that you can use to build

Introduction to WebAssembly for .NET Developers: Building with Uno Platform, XAML, and C#

In a previous post on WebAssembly, we briefly introduced the concept of WebAssembly and what framework/library you need to build WebAssembly apps with .NET. This post will be more practical. I’ll show you how to build a web application utilizing WebAssembly with .NET, XAML, and C#. You’ll build a simple XAML app with some form controls to collect data and display that data in a ListView. Here’s how the app you will build will look like: Guest post by Peter Mbanugo. At the end you’ll learn: – How to create a WebAssembly .NET project. – How to deploy the web app. – Set up your computer for WebAssembly app development with .NET Core and Uno platform. In order to easily follow along, you need to have some knowledge of C# and either XAML, Windows Forms, or WebForms, but I’ll be chiming in with some context so that even if you’ve never worked with XAML, you can easily follow along. Project Set-Up You can build Uno platform apps for WebAssembly, Windows, Linux, macOS, and the different mobile OS. The setup is different for each platform but I’ll detail the steps for creating an Uno project using both Visual Studio and VS

Beautiful WebAssembly Charts courtesy of Syncfusion and Uno Platform

A few weeks back Syncfusion announced their UWP Charts now support Uno Platform and run on WebAssembly. We’ve worked together with Syncfusion team to make this a reality. As this happened just during the UnoConf timeframe, these important news might have gotten lost in the buzz of announcements we made – support for Linux, experimenting with Tizen, Material and Fluent out of box support etc etc. So with this blog we simply want to surface out these beautiful line-of-business charts you can use in WebAssembly today. After all, what is a great looking LOB application without some pretty and interactive charts – right? Syncfusion has released thirteen charts compatible with WebAssembly – see them in action below. We’d also love to hear from you about which should be the next control we work on together with Syncfusion – drop by Uno Platform channel at UWP Discord community to let us know. Currently thirteen charts are supported: Column chart Bar chart Line chart Spline chart Area chart SplineArea chart Scatter chart Bubble chart Pie chart Doughnut chart Semi pie chart Semi doughnut chart Stacked doughnut chart For detailed steps on how to embed these charts in your solution please see Syncfusion

Using WebAssembly Modules in C#

This article covers Implementing custom module validation in an ASP.NET Core MVC web application Using Emscripten to create a WebAssembly module that can be used outside the browser Using WebAssembly modules in your C# code Imagine you’re working for a company who’s about to build a web application for expense reimbursements. Before they do, they task you with building a prototype to evaluate several things including if WebAssembly can be leveraged both on the client in JavaScript and on the server in C#. For the prototype, you’ll create an ASP.NET Core MVC web application. The MVC application has good built-in validation but the final product will need some additional custom validation. For the prototype you’ll keep the validation simple because you just want to know if it’s possible to use WebAssembly in both the browser and in the C# code. The following image shows the two web pages that you need to build for this prototype: For this prototype, you’re going to implement WebAssembly validation in the JavaScript for the Amount field and in C# for the Description field. Validation is performed in the browser primarily so that a web application is more responsive to the user’s actions. For example,

Top 5 WebAssembly Use Cases for .NET Developers

If you are an enterprise software developer, WebAssembly probably crosses your news feeds frequently. Usually the use cases are related to games – someone has ported Doom3 or the Flight Simulator, or some performance improvement over a JavaScript library, which may create the illusion WebAssembly is ‘not meant for you’. The reality couldn’t be more different. If you are not paying attention to WebAssembly – you should. The adoption rate is accelerating and WebAssembly is shifting from being relatively unknown technology to mainstream technology as we speak. Below is the list of use cases we come across most often when talking to our customers and community, and sometimes those use cases are even interlocked. 1 – Greenfield Development – Multi-Platform Development Of the five scenarios, this is the most frequent one. You’ve been tasked to develop an app that ‘runs everywhere’ – desktop, mobile, web. Good news for you – no luggage to carry forward, it is a net new app and there is no old code base to consider. A dream job, really. Naturally, no other deployment mechanism will beat the web. However, you are not a fan of JavaScript. WebAssembly to the rescue! As of last year, W3C

Working with SQLite and WebAssembly for .NET Developers

With recent updates of the mono runtime, and the reactivity of the .NET team to fix issues, it’s now possible to use SQLite with the Uno WebAssembly Bootstrapper and Uno Platform apps.This support is now enabled through WebAssembly static linking, and the reuse of LLVM bitcode compiled source, such as SkiaSharp or SQLite. It allows for an easy use of code written in other languages, from an app built with C#. With the Erik Sink’s recent updates to SQLitePCLRaw 2.0, it’s now possible with .NET for WebAssembly to use the existing official packages. This also enables Entity Framework Core 3.1, and Frank Krueger’s SQLite-net to work out of the box without any specific configuration for WebAssembly. About Uno Platform For those new to Uno Platform – it enables for creation of single-source C# and XAML apps which run natively on iOS and Android, macOS and Web via WebAssembly. Uno Platform is Open Source (Apache 2.0) and available on GitHub. To learn more about Uno Platform, see how it works, or create a small sample app.   Client-side SQLite and Entity Framework Core In order to demonstrate the use of client-side only technologies in the browser, we’ve updated our SQLite 3.3 + EFCore 3.1

How to embed JavaScript components in C# built Uno WebAssembly Web Applications

We often get asked if it is possible to integrate Uno-WASM Web Applications with existing JavaScript components. Since WebAssembly code is running inside browser’s JavaScript context, the answer is “Yes” and it is actually quite simple to do it. In this article we will explore how you can create interoperability (interop) between Uno-WASM managed code and JavaScript context of an application. The two sample apps with code we provide will help you understand how to use the integration in actual application code. For the purpose of the examples we will create an application using a well known date/time picker control called Flartpickr as well as syntax visualizer called PrismJS. In the end you will generate applications looking like this:   Leveraging the Uno.WASM Bootstrapper At the heart of Uno-WASM, there’s a package called Uno.Wasm.Bootstrap (Uno Bootstrapper) project. It contains the tooling required to build, package, deploy, run and debug a .NET project in a web browser using WebAssembly. HTML5 Is a Rich and Powerful Platform Uno Platform fully embraces HTML5 as its display backend when targeting WebAssembly (WASM). As a result, creating hybrid HTML/Uno-WASM apps becomes easy. That also means application can reuse existing JavaScript components directly, often unchanged. Access

Announcing Uno Platform Support for MSAL.NET for WebAssembly Applications

We are happy to announce the support for MSAL.NET (Microsoft Authentication Library) on WebAssembly. This addition allows developers to cross-target use Azure AD, Azure AD B2C and ADFS authentication when building mobile, web and desktop applications. You will now able to access the Microsoft Graph API from your WebAssembly application. This new integration allows accessing any resources protected by Azure Authentication.   Benefits of using Microsoft Authentication Library (MSAL) in enterprise applications Adding the Microsoft Identity Platform (MSAL) to your project will allow easy universal authentication of your users across the web and your local servers. For example, by getting a security token to access Microsoft Graph API you could: • Search for a document on SharePoint • Check for conference room availability • Get user thumbnail • Look-up an employee in the corporate directory • … or any other part of the Graph API You can use it as an SSO (Single Sign-On) to your own backend or 3rd party services. Authentication on WebAssembly – no longer a missing piece for true enterprise applications Uno Platform support for MSAL was already available using .net standard 1.3 on Android, iOS and macOS platforms but it was lacking support for in-browser

Porting an UWP app to iOS, Android and Web. A 5,000,000-app-downloads developer story

Just recently I have converted one of my UWP games to Uno Platform – The Minesweeper 10 and I wanted to share my experience. In just about 4 hours I was able to have it run cross-platform on iOS, Android and Web! The Challenge I have developed many apps and games using UWP. To date I have almost 5 million app downloads in the Microsoft Store which are played by thousands of users on daily basis. To keep my development going most of my games use Ads for monetization. Unfortunately for me, and developers like me, in February Microsoft announced that they would stop supporting Ads in UWP in June. This would mean that I would lose most of my income and that I needed to act fast. In addition, I regularly get emails from my users asking if my games are also available on Android and iOS. They were not, which always made me feel like I was missing out on a bigger opportunity to monetize the work I already did for UWP and will continue with WinUI. Moving Minesweeper and other UWP apps I made the decision to try to move my apps to Android and iOS as