TirsvadCLI Dotnet.DefaultFiles

Github repository

Documentation

    README

    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.
    2. Download the setupSolutionCleanArchentectureCSharp.ps1 script from this repository and place it in the new folder.
      curl -LJO https://raw.githubusercontent.com/TirsvadCLI/Dotnet.DefaultFiles/refs/heads/main/setupSolutionCleanArchentectureCSharp.ps1
    
    1. Run the provided PowerShell script to scaffold a new solution:
    ./setupSolutionCleanArchentectureCSharp.ps1
    

    This will create the recommended folder structure, add default files, and configure the solution for Clean Architecture.

    Example with a blazor project:

    We will create a new folder named MyBlazorApp, download the setup script, and run it to scaffold a new Blazor project with Clean Architecture principles:

    mkdir MyBlazorApp
    cd MyBlazorApp
    curl -LJO https://raw.githubusercontent.com/TirsvadCLI/Dotnet.DefaultFiles/refs/heads/main/setupSolutionCleanArchentectureCSharp.ps1
    ./setupSolutionCleanArchentectureCSharp.ps1 blazor
    

    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
    │   │   ├── TirsvadCLI.TestingScript.Web/           # Blazor project
    │   │   └── TirsvadCLI.TestingScript.Web.Client/    # Blazor WebAssembly project
    │   └── WebApi                                      # Web API project
    ├── 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