We are going to create following project structure through PowerShell script. where we are using purely dotnet cli commands
Write-Host "About to Create the directory" -ForegroundColor Green
mkdir Reactivities
cd Reactivities
Write-Host "About to create the solution and projects" -ForegroundColor Green
dotnet new sln
dotnet new webapi -n API
dotnet new classlib -n Application
dotnet new classlib -n Domain
dotnet new classlib -n Persistence
Write-Host "Adding projects to the solution" -ForegroundColor Green
dotnet sln add API/API.csproj
dotnet sln add Application/Application.csproj
dotnet sln add Domain/Domain.csproj
dotnet sln add Persistence/Persistence.csproj
Write-Host "Adding project references" -ForegroundColor Green
cd API
dotnet add reference ../Application/Application.csproj
cd ../Application
dotnet add reference ../Domain/Domain.csproj
dotnet add reference ../Persistence/Persistence.csproj
cd ../Persistence
dotnet add reference ../Domain/Domain.csproj
cd ..
Write-Host "Executing dotnet restore" -ForegroundColor Green
dotnet restore
Write-Host "Finished!" -ForegroundColor Green
It will create folder structure as below
If you open solution file in Visual studio, you can see project structure as below: