Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Blazor: Client-Side Web UI With .NET Core 3.0

Blazor: Client-Side Web UI With .NET Core 3.0

Last month, together with the .NET Core 3.0 release, Microsoft announced the new features of ASP.NET Core 3.0. There were significant changes in the new release, such as support for gRPC and integration with the new .NET Core JSON serialization API. The official announcement of Blazor, however, took the spotlight.

Blazor is a new framework in ASP.NET Core that allows developers to create interactive web applications using C# and HTML. According to Daniel Roth, principal program manager for ASP.NET at Microsoft:

With Blazor a developer can write client-side web UI using .NET and C# instead of JavaScript. Interactive UIs (with components that encapsulate UI logic) are written using C# and Razor and then rendered as HTML and CSS for multiple browser support. All .NET code can be shared with both the client and the server. The new framework supports scenarios with reusable UI components (Razor), client-side routing, forms, and JavaScript interoperability.

During the 2019 edition of .NET Conf, Microsoft demonstrated two different Blazor editions: Blazor Server and Blazor WebAssembly. Blazor Server, shipped together with .NET Core 3.0, allows web applications using Razor components to be hosted in ASP.NET Core servers. Remote clients accessing the application act as thin clients, and the UI in the browser is updated through the use of asynchronous notifications (using the SignalR library).

Blazor WebAssembly, on the other hand, allows single-page applications to run in the client's web browser using a WebAssembly-based .NET runtime. This edition allows support for scenarios involving progressive web applications (PWAs) and offline applications using the client's resources.

Image source: .NET Conf 2019 presentations

Microsoft also announced three other future Blazor editions: Blazor PWA, Blazor Hybrid, and Blazor Native. Also according to Daniel Roth, the main idea behind Blazor PWA is to allow applications developed for Blazor WebAssembly to be distributed as progressive web applications, which would appear as native applications to the target environment. Blazor Hybrid would be used in scenarios involving rendering native .NET applications to Electron, and Blazor Native would use the same programming model - but rendering non-HTML interfaces. While these editions are far ahead in the roadmap, Steve Sanderson - a Microsoft developer on the ASP.NET team - showed how Blazor can be used to build a Flutter application.

The .NET development community has been following the Blazor development with continuous interest. Scott Hanselman, a partner program manager at Microsoft, states in one of his recent blog posts about Blazor:

It's a pretty exciting time on the open web. There's a lot of great work happening in this space and I'm very interesting to see how frameworks like Razor Components/Blazor and Phoenix LiveView change (or don't) how we write apps for the web.

Positive feedback also appeared in other forums. Last year, after the release of a demonstration of Blazor using WebAssembly, quickthrower2 commented on Hacker News:

This framework is still fledgling, however, it is very exciting for a .NET developer, not because it's a shiny new thing to learn, but because it's the opposite ... it's allowing you to reuse existing skills to code for the web, while seemingly allowing you to create a React-like architecture of components/state. All using a decent language C#. This is simplifying things if you are already doing a full stack and working half the time with JS/TS and the other half with C#.

Blazor WebAssembly is currently in preview (with the official release expected to May 2020), and Blazor PWA is scheduled to have previews released with .NET 5. Blazor Native, however, is still listed as "under investigation". Developing Blazor applications requires .NET Core 3.0 and Visual Studio (VS 2019 16.3 for Windows and VS Code with the C# extension for Mac/Linux). All presentations from the .NET Conf 2019 can be found here.

Image source: .NET Conf 2019 presentations

Rate this Article