This repository provides a template for initializing .NET projects with default files and a setup script. It is designed to help developers quickly scaffold a new solution following Clean Architecture principles, including recommended folder structure, configuration, and build scripts.
Dotnet.DefaultFiles serves as a starting point for .NET development. It includes:
- Standard files for solution and project setup
- PowerShell script for creating a new Clean Architecture project
- Create a folder with the name of your new solution. (e.g.,
mkdir MyNewSolution) - Go to the new folder. (e.g.,
cd MyNewSolution)
- Download and run script to scaffold:
- Scaffold a new solution with Clean Architecture principles:
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/TirsvadCLI/Dotnet.DefaultFiles/refs/heads/main/setupSolutionCleanArchentectureCSharp.ps1" -OutFile "setupSolutionCleanArchentectureCSharp.ps1"
.\setupSolutionCleanArchentectureCSharp.ps1- Scaffold a new Blazor project with Clean Architecture principles and WebApi:
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/TirsvadCLI/Dotnet.DefaultFiles/refs/heads/main/setupSolutionCleanArchentectureCSharp.ps1" -OutFile "setupSolutionCleanArchentectureCSharp.ps1"
.\setupSolutionCleanArchentectureCSharp.ps1 -Blazor -ApiThis will create the recommended folder structure, add default files, and configure the solution for Clean Architecture.
The folder structure will be created as follows:
MyBlazorApp/
├── src/
│ ├── Domain/ # Business logic and entities
│ │ ├── Entities/ # Domain entities
│ │ ├── Interfaces/ # Domain interfaces
│ │ └── ValueObjects/ # Domain value objects
│ ├── Application/ # Application services and use cases
│ │ ├── Services/ # Application services
│ │ ├── Helpers/ # Application helpers
│ │ ├── Managers/ # Application managers
│ │ ├── Mappers/ # Application mappers
│ │ ├── DTOs/ # Data transfer objects
│ │ └── Interfaces/ # Application interfaces
│ ├── Infrastructure/ # Data access, external services
│ │ ├── Persistence/ # Database context and repositories
│ │ │ └── Configuration/ # Database configuration files
│ │ └── Repositories/ # Repository implementations
│ ├── Web/ # Web UI projects (if selected)
│ │ ├── MyBlazorApp.Web/ # Blazor project
│ │ └── MyBlazorApp.Web.Client/ # Blazor WebAssembly project
│ └── WebApi # Web API project (if selected)
├── docs/ # Documentation and design files
├── tests/ # Test projects
└── .github # GitHub configuration files
- Edit configuration files as needed (e.g.,
global.json,Directory.Build.props). - Add or update environment variables for your setup.
global.json: .NET SDK version managementDirectory.Build.props/Directory.Build.targets: Solution-wide build settings.gitignore: Standard ignore rulesnuget.config: Custom NuGet feeds- Example scripts for setup and build
- Keep source code in
src/, tests intests/. - Use environment variables for sensitive data.
- Update
README.mdwith any new setup or usage instructions.
For more details, see the Microsoft documentation and Clean Architecture guides.
Distributed under the AGPL-3.0 License.
Jens Tirsvad Nielsen - LinkedIn
