Skip to content

Instantly share code, notes, and snippets.

@jonathascosta
Created March 10, 2020 22:59
Show Gist options
  • Save jonathascosta/695ed64ab8606ff58641e1512d74d43d to your computer and use it in GitHub Desktop.
Save jonathascosta/695ed64ab8606ff58641e1512d74d43d to your computer and use it in GitHub Desktop.
Bash script to create a default solution for .net projects
#!/bin/bash
mkdir $1
cd $1
dotnet new sln
dotnet new classlib -n "$1.Infrastructure.CrossCutting" -f netstandard2.1
dotnet sln add -s "04.Infrastructure" "$1.Infrastructure.CrossCutting"
dotnet new classlib -n "$1.Domain" -f netstandard2.1
dotnet sln add -s "03.Domain" "$1.Domain"
dotnet add "$1.Domain" reference "$1.Infrastructure.CrossCutting"
dotnet new classlib -n "$1.Infrastructure.Persistence.Memory" -f netstandard2.1
dotnet sln add -s "04.Infrastructure" "$1.Infrastructure.Persistence.Memory"
dotnet add "$1.Infrastructure.Persistence.Memory" reference "$1.Domain"
dotnet new classlib -n "$1.Application.DTO" -f netstandard2.1
dotnet sln add -s "02.Application" "$1.Application.DTO"
dotnet new classlib -n "$1.Application.Services" -f netstandard2.1
dotnet sln add -s "02.Application" "$1.Application.Services"
dotnet add "$1.Application.Services" reference "$1.Domain" "$1.Application.DTO"
dotnet new webapi -n $1
dotnet sln add -s "01.Presentation" $1
dotnet add "$1" reference "$1.Application.Services" "$1.Application.DTO" "$1.Infrastructure.CrossCutting" "$1.Infrastructure.Persistence.Memory"
dotnet new classlib -n "$1.Client" -f netstandard2.1
dotnet sln add -s "00.Client" "$1.Client"
dotnet add "$1.Client" reference "$1.Application.DTO"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment