Blazor Bites Series


Depending on which development experience you prefer, you can get up and running with Blazor using either Visual Studio 2019 Preview or Visual Studio Code. Regardless of which you choose you must install the latest .NET Core 3 Preview.

Visual Studio

Start by downloading the latest Visual Studio 2019 Preview. Make sure to select the the ASP.NET and Web Development workload during installation.

Once you've install Visual Studio you then need to install the Blazor Language Services extension from the Visual Studio Marketplace. You're now good to go.

Visual Studio Code

If you'd prefer, you can use VS Code for development which now has Blazor support. You will need to install the Blazor project templates for the dotnet CLI with the following commands.

dotnet new -i Microsoft.AspNetCore.Blazor.Templates

Then you can create and run a new application from the command line, the same as you would any other.

dotnet new blazor -o HelloWorld
cd HelloWorld
dotnet run

Creating a new project with Visual Studio

Once you've installed all the prerequisites, open up Visual Studio 2019 and create a new project. To get to the Blazor template select the ASP.NET Core Web Application from the list.

Give you application a name and click Create. You will then see the following screen where you can choose the type of project you want.

There are 3 project types available today. Blazor (client-side), Blazor (ASP.NET Core hosted) and Blazor (server-side).

Blazor (client-side)

This is the project to select when you are interested in creating a client-side only application running on WebAssembly (WASM). This project type has no backing API included.

Blazor (ASP.NET Core Hosted)

This project is for full stack C# development. You get the same project as with the Blazor (client-side) template, but with this template you also get an ASP.NET Core WebAPI project. The API project is configured to serve the Blazor application as well as act as a backing API.

Blazor (server-side)

This project type is for running Blazor on the server on the full ASP.NET Core runtime. You can read more about Blazor (server-side) in a post I published here.

Once you've selected the project type you're interested in click Create and after a few seconds you will have a new project ready to go.

You can run the project and you should see the basic starter app after a few seconds.

Blazor Library

This project type isn't available via Visual Studio, only via the dotnet CLI. This project type allows developers to create reusable component libraries that can be shared between projects or packaged up as nuget packages.

In order to create a new Blazor Library project you need to have the latest templates installed.

dotnet new -i Microsoft.AspNetCore.Blazor.Templates

Once you have them installed you can then use the following command to create a new Blazor Library

dotnet new blazorlib -n MyBlazorLibrary


In this post we've covered how to setup our Blazor development tools either using Visual Studio 2019 or Visual Studio Code. We've also covered how to create a new project either using the dotnet CLI or via Visual Studio. Finally we looked at the different project type available to us for Blazor.