Project Structure

Program.cs — entrypoint; host; startup

  • Adds the root component (App.razor)

├──App.razor — the root component; sets up client-side routing using the Router component; Router intercepts browser navigation and renders the page that matches the requested address
├──_Imports.razor — common namespaces made available to all Components ├──wwwroot/ — the web root
├──appsettings.json — environment app settings
└──index.html — when any page of the app is initially requested, this page is rendered and returned in the response
  - This page defines a <div> that specifies where the root App component is rendered
  - <head> is located here
├──Shared/
├──MainLayout.razor — the app’s layout component
  └──MainLayout.razor.css — stylesheet for the above layout
├──NavMenu.razor — implements sidebar navigation; includes NavLink component which renders navigation links to other components
  └──NavMenu.razor.css — stylesheet for the above
└──SurveyPrompt.razor — Blazor survey component
├──Properties/launchSettings.json — development environment configuration
├──Pages/
├──Counter.razor — the Counter page
├──Error.razor — rendered when an unhandled exception occurs
├──FetchData.razor — the Fetch Data page
└──Index.razor — the home page
├──Data/WeatherForecast class and implementation of WeatherForecastService that provides example weather data to app’s FetchData component.

Blazor WASM Hosted (dotnet new blazorwasm --hosted)

Includes these ASP.NET Core projects with these additional files:
├──Client — the Blazor WASM app
├──Server — serves the Blazor WASM app and weather data to clients
  └──Controllers/WeatherForecastController.cs
├──Shared — maintains common classes, methods and resources
  └──WeatherForecast.cs