Blazor web app project structure

Blazor web app project structure

Explorer

  • .confignew
  • dotnet-tools.jsonnew
  • .git…
  • .vs…, not committed
  • .editorconfignew
  • .gitignore
  • ClinicApp
  • bin…, not committed
  • obj…, not committed
  • appsettings.json
  • appsettings.Development.json
  • ClinicApp.csproj
  • Program.cs
  • ClinicApp.Client
  • bin…, not committed
  • obj…, not committed
  • _Imports.razor
  • ClinicApp.Client.csproj
  • Program.cs
  • ClinicApp.sln
  • Directory.Build.propsnew
  • Directory.Packages.propsnew
  • docker-compose.ymlnew
  • global.jsonnew
  • README.md
  • testsnew
  1. # Create the app with Server and WebAssembly interactivity per page (creates ClinicApp, ClinicApp.Client and a solution)

    dotnet new blazor -n ClinicApp -int Auto
  2. # Or add Identity login pages from the start (SQLite by default)

    dotnet new blazor -n ClinicApp -int Auto -au Individual
  3. # Run it with hot reload

    cd ClinicApp && dotnet watch --project ClinicApp
  4. # Repository files from the official item templates

    dotnet new gitignore && dotnet new editorconfig && dotnet new globaljson
  5. # Growing: EF Core with PostgreSQL and the EF Core CLI as a local tool

    dotnet add ClinicApp package Npgsql.EntityFrameworkCore.PostgreSQL && dotnet new tool-manifest && dotnet tool install dotnet-ef
  6. # Growing: a bUnit test project (xUnit v3 templates)

    dotnet new install xunit.v3.templates && dotnet new xunit3 -n ClinicApp.Tests -o tests/ClinicApp.Tests && dotnet add tests/ClinicApp.Tests package bunit && dotnet sln add tests/ClinicApp.Tests
  7. # Growing: shared build settings and central package versions

    dotnet new buildprops && dotnet new packagesprops
  8. # Production: browser tests with Playwright for .NET

    dotnet new xunit3 -n ClinicApp.E2ETests -o tests/ClinicApp.E2ETests && dotnet add tests/ClinicApp.E2ETests package Microsoft.Playwright