Microsoft Blazor Enables Native App Development in C# and .NET

February 12, 2020 Published by: Minesh Doshi

Microsoft Blazor

The Redmond-based software giant Microsoft has recently launched a framework to develop interactive, client-side web UIs by using C# and .NET languages. What’s more, Microsoft has also designed Blazor to build native-like mobile apps with C# web technology. Microsoft will also provide experimental support for native app development using Blazor.

Blazor framework came in 2017 as an experiment to host the .NET runtime in the browser by compiling .NET to WebAssembly. The name Blazor is taken from Razor, the syntax used to combine HTML with C# in ASP.NET for creating a dynamic web page. As a contrast to Razor, the Microsoft Blazor enables web developers to execute the C# code in the browser instead of the server.

The evolution of Blazor began in the year 2018 when Microsoft made it an official part of ASP.NET Core. Blazor was also extended with Blazor Server that facilitates the web developers to run .NET code on the server and communicate with the UI in the browser. Here, Blazor uses SignalR real-time messaging to develop a UI (User Interface) using C# instead of JavaScript.

In the online .NET Conf, Microsoft has explained further plans for the Blazor framework. There came the biggest news- the announcement of experimental Mobile Blazor. As stated by Eilon Lipton, Principal Software Engineer at Microsoft, “Mobile Blazor Bindings enable developers to build native mobile apps using C# and .NET for iOS and Android using familiar web programming patterns.” Here, the actual UI components are based on Xamarin, Microsoft’s popular cross-platform app development framework.

However, instead of XAML of Xamarin, the Blazor uses Razor syntax to define the UI. However, the code for Mobile Blazor is still in the nascent and experimental phase, so native app development is yet to get its assured benefit and general availability. It is interesting to note that the Blazor is different from the technology like Apache Cordova because the Blazor uses web programming patterns whereas Apache Cordova uses web browser components for developing native-like mobile apps.

Also Read- Native App Development or Hybrid App Development- Which is Better?

Two Ways for Mobile App Development Using Blazor

1. Web Assembly Method

blazor

Image Source

Blazor uses Web Assembly that ships in all major browsers. Here, the browser acts as a host for the application. All the files built in a Blazor Web Assembly application are sent to the browser after compilation. The browser runs JavaScript, HTML, and C# in its execution sandbox. The browser also runs a version of the .NET Runtime. It means that the app developers can execute calls to .NET from within the browser. The full-fledged application remains in the browser and it can be run offline as well.

Web Assembly is equipped with all major browsers. It can reuse .NET components and utilize Microsoft tooling and debugging. Developers can build rich front-end applications by using C#. This method is good for developing low latency applications like games. If app developers do not find it necessary, they can skip communication with a server. The application can be run offline after downloading from the browser.

2. Blazor Server

blazor

Image Source

As per this method, developers build applications with a server powered by .NET Core. They send HTML and JavaScript to the browser as a client. This method enables mobile app developers to get the full power of the .NET framework. Here web assembly is not required and the data remain safe. This method enables developers to make blazing fast thin clients.

Right now, the production-ready part of Blazor is Blazor Server. Blazor Web Assembly will be completed in May 2020. We can expect that there will be a Blazor-based variant for developing web applications, desktop applications, and mobile applications in a couple of years.

Concluding Lines

Microsoft has outlined its vision in the .NET Conf 2019 to cover the full spectrum of apps in Blazor. From server-based web apps to PWAs and hybrid .NET apps to native mobile apps- it is interesting to see how Microsoft Blazor enables web developers to come up with seamlessly-performing apps for modern businesses.

At Semaphore, we build feature-rich native and hybrid apps for global corporate clientele. Our array of services consists of software development, CMS development, web design and development, and mobile app development. Let’s connect through info@semaphore-software.com and build awesome app solutions, together.