I don't find any existing questions/answers dealing with this specific piece.
Can someone explain this...how is it that I start the .Server project and it ends up showing me the .Client WASM app?
Create a "Hosted" Blazor WASM application and Visual Studio 2022 scaffolds 3 projects:
Curiously Blazor.Server has a project reference to Blazor.Client. Also curiously, the debugging start-up project is "Blazor.Server". This project has no UI so why would it be the startup project?
Somehow when you hit F5 to start debugging, Visual Studio starts the Blazor.Server project. But that "mysteriously" starts the Blazor.Client app. For the life of me, I cannot figure out the magic that the .Server project is doing to start the .Client WASM app.
Obviously there is the project reference...and the .Server "Program.cs" file has this:
app.MapFallbackToFile("index.html");
I'm used to ASP.Net Webforms or Winforms where there is clearly selected a startup project and a startup page/class so it is easy to see the Application starting and then showing the UI you select.
- Visual Studio starts the Blazor.Server project.
- But that "mysteriously" starts the Blazor.Client app.
The first statement is true, the second is not.
VS does indeed start the Server and that starts listening.
But VS also starts a pre-configured Browser and points that to the start URL.
You can find the configuration in Properties/launchsettings.json or in the menu bar in the drop-down part of the Run button.
The Wasm client is then loaded into the Browser (as static files) and there the index.html page gets the JS/Wasm/Blazor ball rolling.
Curiously Blazor.Server has a project reference to Blazor.Client
That is for the sake of MsBuild, so your client binaries are copied to the Server's output folder. You can remove that reference but then you need to add some config with strings. Less flexible.