# PARAMETERS
COMPANY=CompanyName
SYSTEM=SystemName
PROJECT=ProjectName
SOLUTION_NAME=$COMPANY.$SYSTEM.$PROJECT
FRAMEWORK=net8.0
# BUILD .NET PROJECT
## Make code projects
dotnet new classlib -o src/Application/Core --framework $FRAMEWORK
dotnet new classlib -o src/Application/ApplicationCore --framework $FRAMEWORK
dotnet new classlib -o src/Infrastructure/Infrastructure --framework $FRAMEWORK
dotnet new classlib -o src/Infrastructure/Data --framework $FRAMEWORK
dotnet new maui -o src/Presentation/App --framework $FRAMEWORK --applicationId $SOLUTION_NAME
dotnet new nunit -o src/Tests/UnitTests --framework $FRAMEWORK
## Make solution
dotnet new sln -n $SOLUTION_NAME
dotnet sln add src/Application/Core/
dotnet sln add src/Application/ApplicationCore/
dotnet sln add src/Infrastructure/Infrastructure/
dotnet sln add src/Infrastructure/Data/
dotnet sln add src/Presentation/App/
dotnet sln add src/Tests/UnitTests/
## Add project references
### Core project
dotnet add src/Application/ApplicationCore reference src/Application/Core
dotnet add src/Infrastructure/Infrastructure reference src/Application/Core
dotnet add src/Infrastructure/Data reference src/Application/Core
dotnet add src/Presentation/App reference src/Application/Core
### ApplicationCore project
dotnet add src/Infrastructure/Infrastructure reference src/Application/ApplicationCore
dotnet add src/Infrastructure/Data reference src/Application/ApplicationCore
dotnet add src/Presentation/App reference src/Application/ApplicationCore
### Infrastructure project
dotnet add src/Presentation/App reference src/Infrastructure/Infrastructure
### Data project
dotnet add src/Presentation/App reference src/Infrastructure/Data
### App project
dotnet add src/Tests/UnitTests reference src/Presentation/App
## Delete garbage
find . -type f \( -name "Class1.cs" -o -name "UnitTest1.cs" \) -delete
## Change default values
find . -type f -name "*.csproj" -print0 | xargs -0 sed -i 's/<ImplicitUsings>enable/<ImplicitUsings>disable/g'
find . -type f -name "*.csproj" -print0 | xargs -0 sed -i 's/<Nullable>enable/<Nullable>disable/g'
## Add custom namespaces
sed -i 's/<PropertyGroup>/<PropertyGroup>\n\ <RootNamespace>'"$SOLUTION_NAME"'.Application.Core<\/RootNamespace>/g' src/Application/Core/Core.csproj
sed -i 's/<PropertyGroup>/<PropertyGroup>\n\ <RootNamespace>'"$SOLUTION_NAME"'.Application.ApplicationCore<\/RootNamespace>/g' src/Application/ApplicationCore/ApplicationCore.csproj
sed -i 's/<PropertyGroup>/<PropertyGroup>\n\ <RootNamespace>'"$SOLUTION_NAME"'.Infrastructure.Data<\/RootNamespace>/g' src/Infrastructure/Data/Data.csproj
sed -i 's/<PropertyGroup>/<PropertyGroup>\n\ <RootNamespace>'"$SOLUTION_NAME"'.Infrastructure.Infrastructure<\/RootNamespace>/g' src/Infrastructure/Infrastructure/Infrastructure.csproj
sed -i 's/<PropertyGroup>/<PropertyGroup>\n\ <RootNamespace>'"$SOLUTION_NAME"'.Presentation.App<\/RootNamespace>/g' src/Presentation/App/App.csproj
sed -i 's/<PropertyGroup>/<PropertyGroup>\n\ <RootNamespace>'"$SOLUTION_NAME"'.Tests.UnitTests<\/RootNamespace>/g' src/Tests/UnitTests/UnitTests.csproj
Last active
May 24, 2024 01:17
-
-
Save cgalvist/f0b291dcae29785598e50b617868717b to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment