Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check if Blazor app is WebAssembly or Server?

Tags:

blazor

Started a project via cmd so not sure if it is a WebAssembly App or Server side app.

Anybody know how to check this in an easy way in Visual Studio/cmd?

like image 583
JoBo Avatar asked Dec 06 '25 12:12

JoBo


2 Answers

You can open the .csproj file and look at the first line. Blazor Server App project is using Sdk="Microsoft.NET.Sdk.Web" but Blazor WebAssembly App is using Sdk="Microsoft.NET.Sdk.BlazorWebAssembly".

like image 127
Andrew Malkov Avatar answered Dec 09 '25 14:12

Andrew Malkov


Update (.net 5 and up)

The quickest way is to look in Program.cs

Blazor WebAssembly:

var builder = WebAssemblyHostBuilder.CreateDefault(args);

Blazor Server:

var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();

also, the presence of any .cshtml files, mainly Pages\_Host.cshtml, means it is a Blazor Server project.

Old answer

There are several points in the project you can easily check.

Look for the line services.AddServerSideBlazor(); in ConfigureServices()

like image 43
Henk Holterman Avatar answered Dec 09 '25 13:12

Henk Holterman