What is Blazor?

Blazor is a WebAssembly based front end web application framework that uses .NET, C# and HTML. It is open source and maintained by Microsoft and the community to address the many challenges encountered in developing single page applications.

Note - Blazor is currently experimental and should not be used in production. This website is still under construction.

How does Blazor works?

A Blazor app consists of compiled .NET assemblies that are downloaded and run in a web browser using a WebAssembly-based .NET runtime. The app can also call into JavaScript or access the DOM through Javascript interop APIs. As Blazor is a component-based framework that supports features such as bindings, direct access to the DOM is minimized.

"Hello World" application in Blazor

Requirements

  • Install .NET Core SDK 2.1 (or later)

Install latest Blazor Templates with command-line (Windows Command Prompt or MAC Terminal)


dotnet new -i Microsoft.AspNetCore.Blazor.Templates

Create the Blazor app


dotnet new blazorwasm -o BlazorHelloWorld

Start the Blazor app


cd BlazorHelloWorld

dotnet run

You should see the following output:


Hosting environment: Production
Content root path: ......BlazorHelloWorld
Now listening on: http://localhost:5000
Now listening on: https://localhost:5001
Application started. Press Ctrl+C to shut down.
            

Launch your browser and point it to http://localhost:5000