Check if Blazor app is WebAssembly or Server?

Viewed 1944

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

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

4 Answers

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

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

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".

If three projects (.Client, .Server, .Shared) were created, this is a WebAssembly Blazor App hosted (on the server).

If a single project was created, it might be a WebAssembly Blazor stand alone App, or a Blazor Server App. In that case you should look for the Startup class. If exists, that means that your project is a Blazor Server App, if not then it is a WebAssembly Blazor stand alone. This is basically how I often view the structure of my solution, by a quick scan.

You could check it by running the app in localhost and then checking the initiator in network traffic when the app launches.

Related