Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Running .NET in the Browser with Ooui

Running .NET in the Browser with Ooui

This item in japanese

Desktop application developers have been in a difficult position these past few years with all of the focus given to web and mobile apps. With Microsoft’s future plans for the Windows platform currently undefined and UWP apps not breaking through, .NET developers cannot be blamed if they feel a bit left behind. Having new ways of applying their knowledge of C# is a key challenge to overcome.

That is what makes recent work to use C# on the browser so interesting. Earlier this year, Microsoft announced their support for Blazor, and now Frank A. Krueger has developed the Ooui library which allows C# or F# to be used to write applications that run in the browser. Ooui can target WASM, enabling "Xamarin.Forms" app to be deployed in WebAssembly, and the result runs entirely in-browser without the need for an application server.

This isn’t the only platform, as Krueger explains other targets are available including Web DOM using ASP.NET Core, WebAssembly, or Ooui’s built-in web server. The underlying technology works as follows: for WebAssembly projects, all communication between the web browser and your app happens in-process. The other projects use web sockets for browser-app communication to keep the UI and application state in-sync.

Krueger has provided some helpful proof-of-concept demos to illustrate these concepts. A basic XAML Editor shows how XAML can be edited in-browser with the changes displayed in real time. A set of samples have been provided, showing both "Xamarin.Forms" and basic web controls.

It is quite easy to experiment with Ooui firsthand. Simply create a new Console app in .NET Core, and add references to Ooui.Wasm and Ooui.Forms. Next build the app using the regular dotnet build and it is then ready to be deployed. You can test the resulting code out via a dotnet-server or copy the files in the dist directory to any web server that can serve static files.

Rate this Article