Search code examples
.net-coreblazorblazor-webassembly

Launching both client and server projects concurrently through Visual Studio in a Blazor WebAssembly solution with Clean Architecture


I am experimenting with various architecture designs for a .NET Core solution using Blazor WebAssembly. I am using Clean Architecture and have separate projects for the client and server. For development purposes, I'd like to find a way to launch both the client and server projects concurrently through Visual Studio.

The solution structure is as follows:

└───DemoBWasm
    └───src
        ├───DemoBWasm.Launcher
        ├───Client
        │   └───DemoBWasm.Client
        │       ├───Pages
        │       ├───Properties
        │       ├───Shared
        │       └───wwwroot
        │           ├───css
        │           │   ├───bootstrap
        │           │   └───open-iconic
        │           │       └───font
        │           │           ├───css
        │           │           └───fonts
        │           └───sample-data
        ├───Server
        │   ├───DemoBWasm.Application
        │   ├───DemoBWasm.Domain
        │   ├───DemoBWasm.Infrastructure
        │   └───DemoBWasm.Server
        │       ├───Controllers
        │       └───Properties
        ├───Shared
        │   └───DemoBWasm.Shared
        └───Test
            ├───Client
            │   └───DemoBWasm.Client.Test
            └───Server
                └───DemoBWasm.Server.Test

I want to be able to launch both the server and client via visual studio for quick development and debugging

currently I have DemoBWasm.Launcher that runs both projects via dotnet watch --project xxx

I want this feature as the idea is to deploy the server and client on seperate systems but I would like to save time during development

Use this script if you want to generate my structure for testing; https://gist.github.com/JasperDaDolphin/4863e2cd6e6cbc3d934463464ba54d67


Solution

    1. Right click on the solution, click Set StartUp projects..
    2. Select Multiple Startup Projects radio button
    3. Set the Action dropdown to Start for those two projects you want to start simultaneously, adjust the startup order so the Server starts first.

    Now when you press F5, it should launch both.