Microsoft Blazor - C# in Your Browser

Apr 24, 2018 1:40:00 PM

shutterstock_765562225.jpgFor a long time, developers with expertise in the .NET framework have wanted to be able to create compelling, performant web applications that leveraged the rich .NET environment and its easy-to-use programming languages. It wasn’t impossible, but it always seemed more complex than it ought to be—certainly more complex than delivering similar applications in JavaScript or PHP.

That may finally be changing soon. Microsoft has introduced an experimental, open-source web UI framework that it’s calling Blazor. The Blazor project seeks to enable .NET developers to deliver C#-based single-page web applications that run on the client and—crucially—don’t take forever to load.

First, Some Definitions

To understand how all of this is supposed to work, some definitions are in order.

  • Single-page application (SPA): A web application that loads in a single HTML page and dynamically changes as the user interacts with it, without requiring page reloads, server calls, or links to other HTML pages. Most or all of the processing takes place in the client (browser) which increases application performance at the expense of increased page loading time.
  • Razor: An HTML syntax that enables developers to embed server-based C# code in HTML pages.
  • WebAssembly: An open web standard that enables delivery of web applications in binary format for execution in the browser.

The name “Blazor” comes from a combination of “browser” and “Razor.”

Advantages for Developers—and Businesses

Microsoft’s Blazor project brings together the .NET ecosystem—in particular, its popular C# and F# languages—with Razor and WebAssembly to enable quick-loading, fully featured single-page applications that run identically in any browser. This affords a number of advantages for developers:

  • Familiar developer tools. Developers can use the powerful .NET programming languages and standard APIs, as well as the familiar Microsoft Visual Studio suite of developer tools to develop and debug their applications.
  • Speed, scalability, security. The same tools, techniques, and features that have made .NET such a powerful force for server-side development can now be brought to bear on the client side.
  • Efficient testing and tweaking. Applications developed with Blazor can be live-reloaded in the browser, reducing the develop-test-tweak-repeat cycle time.
  • One code base, many browsers. Differences between browsers, and even between different versions of the same browser, have long been a headache for web app developers, who have had to go to great lengths to get their apps to look and behave the same across browsers. With WebAssembly, this nightmare should come to an end.

From a business standpoint, there are potential resource efficiencies to be gained here. .NET developers, which are numerous, will now be able to use their existing skill sets and tools to develop web applications, obviating the need for separate, and often higher-priced, web application specialists. This also decreases long-term application maintenance costs, because any .NET developer should be able to come in and make updates to the code.

One thing that Microsoft has been careful to stress is that Blazor is not intended to be a cross-platform development tool. Code for existing .NET desktop applications or Xamarin-based mobile apps can’t simply be plopped into Blazor and magically become web apps. Although some code reuse might be possible, Blazor’s strength will lie in its ability to build native web applications. And such applications will have, for now at least, separate code bases from their desktop and mobile counterparts.

The other limitation is that as of this writing, Blazor is not yet an official product: it’s still experimental, and Microsoft is asking developers to poke around at it and provide feedback. Much of the anticipated functionality is not yet available, and there are no installers and little documentation or support. It will be a while before it becomes something that any .NET developer can pick up and run with. But once it gets to that point, it promises to be an exciting addition to the .NET ecosystem, filling a gap that’s long been an issue for developers and businesses alike.

Brian Geary

Written by Brian Geary

Brian is a true believer in the Agile process. He often assists the development process by performing the product owner role. In addition to his technical background, he is an experienced account manager with a background in design and marketing.

Lists by Topic

see all