In this session, you'll setup your machine for Blazor development and build your first Blazor app.
Install the following:
-
.NET Core 2.1 SDK (2.1.500 or later).
-
Visual Studio 2017 (15.9 or later) with the ASP.NET and web development workload selected.
-
The latest Blazor Language Services extension from the Visual Studio Marketplace.
-
The Blazor templates on the command-line:
dotnet new -i Microsoft.AspNetCore.Blazor.Templates
To create a Blazor project in Visual Studio:
-
Select File > New > Project. Select Web > ASP.NET Core Web Application. Name the project "BlazorApp1" in the Name field. Select OK.
-
The New ASP.NET Core Web Application dialog appears. Make sure .NET Core is selected at the top. Also select ASP.NET Core 2.1. Choose the Blazor template and select OK.
-
Once the project is created, press Ctrl-F5 to run the app without the debugger. Running with the debugger (F5) isn't supported at this time.
Note
If not using Visual Studio, create the Blazor app at a command prompt on Windows, macOS, or Linux:
dotnet new blazor -o BlazorApp1
cd BlazorApp1
dotnet run
Navigate to the app using the localhost address and port provided in the console window output after dotnet run
is executed. Use Ctrl-C in the console window to shutdown the app.
The Blazor app runs in the browser:
Congrats! You just built and ran your first Blazor app!
If you have more time, try out the rest of the introductory Blazor tutorial
Next up - Components and layout