Prerequisites

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

You will also need to install the latest templates via the dotnet CLI.

dotnet new -i Microsoft.AspNetCore.Blazor.Templates

Visual Studio

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

Visual Studio Code

If you’d prefer, you can use VS Code for development which now has Blazor support. You can create and run new project via the dotnet CLI. Run dotnet new to see a list of the available project types. The two types for Blazor are in the image below.

Creating a new project with Visual Studio

Once you’ve installed all the prerequisites, open up Visual Studio 2019 and create a new project. Select Blazor App 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 Blazor app you want.

The two options are Blazor Server App and Blazor WebAssembly App.

Blazor Server App

This project type is for running Blazor on the server on the full ASP.NET Core runtime. It uses a SignalR connection to handle user interactions. You can read more about Blazor Server Apps in a post I published here.

Blazor WebAssembly App (Preview)

This option creates a Blazor app which runs on WebAssembly entirely in the clients browser. This is a stand-alone project type and has no backing API. If you require a backing API then select the ASP.NET Core Hosted checkbox on the options panel to the right.

The API project is configured to serve the Blazor WebAssembly App as well as act as a backing API.

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.

Summary

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.