About Blazor

Introduction to Blazor

Microsoft has recently announced the release of a new .NET web framework, Blazor. Blazor is a free, open source Web framework to build Web apps using C# that run in a Web browser. In this article, we will understand Blazor and setup Blazor development environment in our machine and execute our first program in ASP.NET core using Blazor and Visual Studio 2017. We will also create a sample calculator application using Blazor.

What is Blazor?

Blazor is a new .NET web framework for creating client-side applications using C#/Razor and HTML that runs in the browser with WebAssembly. It can simplify the process of creating single page application (SPA) and at the same time enables full stack web development using .NET.

Using .NET for developing Client-side application has multiple advantages that are mentioned below,

      1. NET offers a range of API and tools across all platform that are stable and easy to use.
      2. The modern languages such as C# and F# offer a lot of features that make programming easier and interesting for developers.
      3. The availability of one of the best IDE in form of Visual Studio provides a great .NET development experience across multiple platforms such as Windows, Linux, and MacOS.
      4. .NET provides features such as speed, performance, security, scalability, and reliability in web development that makes full stack development easier.

      Microsoft defined Blazor as an experimental project and since it is still in alpha phase (as of today March 30, 2018) so, it should not be used in a production environment.

      What is WebAssembly?

      WebAssembly (abbreviated Wasm) is low-level assembly-like language with a compact binary format that can run in modern web browser. Since it is a low-level binary code, it cannot be read/written by humans but we can compile the code from other languages to WebAssembly to facilitate their execution on the browser. It is a subset of JavaScript and is designed to complement and run alongside JavaScript. It enables us to run code written in multiple language on the web at near native speed.

      WebAssembly is developed as a web standard and is supported by all the major browsers without plugins.

      Why use Blazor?

      Blazor makes web development easier and more productive by providing a full stack web development with .NET. It runs in all browsers on the real .NET runtime and have full support for .NET Standard without the need of any extra plugin. Blazor is fast, have reusable components and is open-source with a great support from the community.

      Blazor also supports features of a SPA framework such as:

      • Routing
      • Layouts
      • Forms and validation
      • JavaScript interop
      • Build on save during development
      • Server-side rendering
      • Dependency Injection

      Prerequisites

      • Install .NET Core 2.1 Preview 2 SDK
      • Install latest preview of Visual Studio 2017 (15.7)