Preparing Local Development Environment
Learn to set up local development environment for Blazor development.
Before we can start developing Blazor applications locally, we need the following:
A machine with Windows, Linux, or macOS operating system
.NET 7 SDK (or newer)
A suitable IDE or code editor
Web development and Blazor workloads enabled
Installing .NET SDK
To take advantage of all Blazor features described in this course, we need to install .NET 7 SDK or later. Although Blazor has been available since earlier versions of SDK, some of the features described in this course have only been introduced in version 7.
To download the latest .NET SDK, you can visit the following link:
https://dotnet.microsoft.com/en-us/download/dotnet
Please note that we need to install the .NET SDK and not the .NET runtime. While the runtime is capable of running .NET applications, it’s not capable of building them.
Installing IDE or code editor
An integrated development environment (IDE) is a tool that allows us to write code and build our applications. A code editor is less powerful than an IDE, as its capabilities are limited to writing and editing the code. However, the major benefit of it is that it's lightweight.
With the .NET SDK, we don’t necessarily require full IDE capabilities, as all actions can be performed from the command line interface (CLI). On the other hand, IDE makes the development process more convenient.
You can choose one of the following tools based on your operating system, budget, and personal preferences. However, the suitable options are as follows.
Visual Studio 2022
This is a Windows-only IDE that comes in different tiers, both free and premium. This is the main Microsoft-made IDE that was primarily designed for .NET development. It can be downloaded via the following link:
https://visualstudio.microsoft.com/vs/
Visual Studio for Mac
This is the Mac version of the Visual Studio IDE. It can be downloaded via the following link:
https://visualstudio.microsoft.com/vs/mac/
JetBrains Rider
JetBrains Rider is a very powerful IDE that can be downloaded for Mac, Linux, or Windows. It comes with many inbuilt tools that improve the software development experience and enhance the quality of code.
It is a premium, paid-for IDE, but a 30-day free trial is available. JetBrains Rider can be downloaded via the link below.
https://www.jetbrains.com/rider/download
Visual Studio Code
Visual Studio Code is a fully customizable code editor that can be installed on Windows, macOS, or Linux. It lacks some features of an IDE, such as the ability to build applications from the user interface. However, when it comes to code editing, it is still as powerful as an IDE.
Visual Studio Code is completely free. It can be downloaded via the following link:
https://code.visualstudio.com/
Enabling web development and Blazor workloads
To be able to develop ASP.NET Core applications in our local development environment, we may need to enable or install appropriate workloads. An IDE should prompt us to install any missing workloads if we start working on an ASP.NET Core project. Alternatively, we can enable those workloads before we start any development work.
Enabling the workloads varies depending on what IDE we use, but the principles are similar. For example, to enable the ASP.NET Core web development workload on Visual Studio on Windows, we can open the “Visual Studio Installer” application, select the edition of Visual Studio that we are using, click the “Modify” option, and check the “ASP.NET and web development” workload, as the image below demonstrates.
Get hands-on with 1400+ tech skills courses.