Reputation: 347
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?
Upvotes: 17
Views: 10400
Reputation: 273494
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.
There are several points in the project you can easily check.
Look for the line services.AddServerSideBlazor();
in ConfigureServices()
Upvotes: 15
Reputation: 21
You could check it by running the app in localhost and then checking the initiator in network traffic when the app launches.
Upvotes: 0
Reputation: 216
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".
Upvotes: 20
Reputation: 45684
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.
Upvotes: 4