This provides sample code that shows various types of Blazor hosting models - Server, WASM (hosted/standalone) and Hybrid (MAUI/WinForm/WPF). They all share the same components with minimal code changes.
Due to the nature of the sample applications, it only targets Windows OS.
-
Fork this repository.
-
Clone the forked repository to your local machine.
-
Open the solution,
BlazorHostingModels.sln
, with Visual Studio. -
Build the entire solution.
There might be a chance that solution build fails. Then, clean the solution first and rebuild the solution.
-
Run the backend API in a separate terminal or console like Visual Studio Code, Windows Terminal or PowerShell.
cd src/BackendApi func start
-
Run each project individually to see how it works.
For the hosted Blazor WASM app, run the following SWA CLI command within Visual Studio Code, Windows Terminal or PowerShell:
swa start