Skip to content

TirsvadCLI/Dotnet.DefaultFiles

Repository files navigation

DownloadsContributorsForksStargazersIssuesLicenseLinkedIn

logo Dotnet.DefaultFiles

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.

Table of Contents

Overview

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

Setup & Usage

Initializing a New Project

  1. Create a folder with the name of your new solution. (e.g., mkdir MyNewSolution)
  2. Go to the new folder. (e.g., cd MyNewSolution)

Windows PowerShell

  1. 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 -Api

This 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

Customizing

  • Edit configuration files as needed (e.g., global.json, Directory.Build.props).
  • Add or update environment variables for your setup.

Default Files Included

  • global.json: .NET SDK version management
  • Directory.Build.props / Directory.Build.targets: Solution-wide build settings
  • .gitignore: Standard ignore rules
  • nuget.config: Custom NuGet feeds
  • Example scripts for setup and build

Best Practices

  • Keep source code in src/, tests in tests/.
  • Use environment variables for sensitive data.
  • Update README.md with any new setup or usage instructions.

For more details, see the Microsoft documentation and Clean Architecture guides.

License

Distributed under the AGPL-3.0 License.

Contact

Jens Tirsvad Nielsen - LinkedIn

Acknowledgements

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors