9/17/2025 Admin
Using Visual Studio Code with Aspire and Blazor
You can use Blazor with Aspire and Visual Studio Code.
Install Visual Studio Code
One of the advantages of using Visual Studio Code rather than Visual Studio, is that Visual Studio Code is lightweight and runs on more platforms.
Go to: https://code.visualstudio.com/download to download and install Visual Studio Code for your OS.
Launch VS Code after installation.
Install the C# Dev Kit Extension
In Visual Studio Code, go to View > Extensions (or press Ctrl+Shift+X
).
Search for C# Dev Kit and click Install Pre-Release Version.
After installation has completed, close and re-open Visual Studio Code.
This extension provides rich C# editing, debugging, and project management features.
Install the .NET Aspire Project Templates
Open the integrated terminal in Visual Studio Code (View > Terminal or Ctrl+’
).
Run the following command: dotnet new install Aspire.ProjectTemplates
After installation has completed, close and re-open Visual Studio Code.
Create the Aspire App Host Project
Select File > New File.
Select .NET: New Project.
Select .NET Aspire App Host.
Create a folder and select it.
Give the project the name AspireVibeCodingVSCode.
Select .sln.
Select Show all template options.
Configure the options so they match the settings in the image above.
Select Create project.
When the dialog appears select Yes, I trust the authors.
Switch to Explorer View
The C# Dev Kit provides the Solution Explorer that allows you to more easily manage your C# project.
Expand the Solution Explorer.
(if you don’t see it, close and re-open your Visual Studio Code)
Create the Blazor Web App Project
Select New Project.
Search for and select Blazor Web App as the template.
Name it BlazorWebApp and press Enter.
Select the Default directory.
Select Show all template options.
Configure the options so they match the settings in the image above.
Select Create project.
Link the Projects
In the Solution Explorer, right-click on the AppHost project (AspireVibeCodingVSCode).
Select Add Project Reference.
Select BlazorWebApp and press Enter.
Update AppHost
Open AppHost.cs
in the AppHost project and add:
builder.AddProject<Projects.BlazorWebApp>("BlazorWebApp");
Select File > Save to save the changes.
Debug and Run
Press F5
or go to Run > Start Debugging.
Select C#.
Select C#: Launch Startup Project.
Select AspireVibeCodingVSCode.
Your browser should open with the running Blazor app hosted by the Aspire App Host.