This batch script is a .NET Core project generator designed to quickly scaffold a new Web API or MVC web project along with supporting class libraries and their necessary dependencies.
This version of the script scaffolds a clean .NET 8 Web API project using Clean Architecture principles.
- Creates a
.NET 8 Web API
project as the main application. - Class libraries:
Abstractions
: Interfaces and contractsRepository
: Data access layer using DapperService
: Business logicCommon
: Logging, shared utilities
- Automatically installs key NuGet packages:
Serilog
,Dapper
,Npgsql
,SqlClient
, and configuration packages
- Adds all necessary project references between layers
- Builds the project and opens the solution folder for development
The MVC version of the script scaffolds a .NET 8 MVC project with dynamic view support.
The script automates the creation of a .NET Core MVC web project with associated class libraries (Abstractions, Repository, Service, Common). It installs necessary NuGet packages, sets up project references, restores, builds the solution.
- Prompts the user for the project name
- Creates a new MVC project targeting .NET 8.0
- Installs Razor Runtime Compilation for dynamic view updates (MVC version only)
- Creates four supporting class libraries:
Abstractions
Repository
Service
Common
Common
:iText7
,Serilog
,Microsoft.CodeAnalysis
,ReportViewerCore
Repository
:Dapper
,Npgsql
,System.Data.SqlClient
- Ensures proper project dependencies:
API/MVC
→ All librariesService
→Repository
,Abstractions
Repository
→Common
,Abstractions
Common
→Abstractions
- Runs
dotnet restore
anddotnet build
to verify dependencies and compilation
- Automatically launches the project folder.
This script is ideal for:
- Quickly scaffolding modular .NET projects
- Following Clean Architecture principles
- Speeding up onboarding and development setup
# Run the batch file
setup-dotnet-project.bat
# When prompted, enter your desired project name