A comprehensive collection of .NET project templates designed for rapid application development with clean architecture principles, dependency injection, and modern .NET features.
This repository contains production-ready project templates for various .NET application types. Each template follows best practices, implements dependency injection patterns, and uses a layered architecture approach for maintainability and scalability.
A command-line interface application template built with .NET, utilizing Spectre.Console for rich console output and command handling.
- Command-based architecture using Spectre.Console.Cli
- Dependency injection with Microsoft.Extensions.DependencyInjection
- Options pattern for configuration management
- Structured logging with ILoggerService
- Weather forecast sample command implementation
graph TD;
A[CliApp/] --> B[src/];
B --> C[DomainName/];
C --> D[Abstractions/];
D --> D1[Services/];
C --> E[Commands/];
C --> F[Common/];
C --> G[Enumerators/];
C --> H[Extensions/];
C --> I[Models/];
C --> J[Options/];
C --> K[Services/];
C --> L[Settings/];
style A fill:#e1f5ff
style C fill:#fff4e1
style D fill:#f0f0f0
style E fill:#f0f0f0
style K fill:#f0f0f0
- Commands: Executable CLI commands (e.g.,
WeatherForecastCommand) - Services: Business logic implementation with DI support
- Options Pattern: Type-safe configuration binding
- TypeRegistrar: Custom type registrar for Spectre.Console DI integration
A Windows Forms application template targeting .NET Framework 4.8 with clean architecture layers.
- Multi-layered architecture (Domain, Application, Infrastructure, Presentation)
- Generic Host implementation for WinForms
- Dependency injection throughout the application
- Configuration management with appsettings.json
- Comprehensive logging infrastructure
- Unit testing with MSTest
graph TD;
A[winforms-net48/] --> B[src/];
A --> Z[tests/];
B --> C[DomainName/];
C --> C1[Extensions/];
B --> D[DomainName.Domain/];
D --> D1[Enumerators/];
D --> D2[Models/];
B --> E[DomainName.Application/];
E --> E1[Abstractions/];
E1 --> E1A[Infrastructure/];
E1A --> E1A1[Providers/];
E1A --> E1A2[Services/];
E1 --> E1B[Presentation/];
E1B --> E1B1[Services/];
E --> E2[Extensions/];
E --> E3[ViewModels/];
B --> F[DomainName.Infrastructure/];
F --> F1[Extensions/];
F --> F2[Providers/];
F --> F3[Services/];
B --> G[DomainName.Presentation/];
G --> G1[Extensions/];
G --> G2[Forms/];
G --> G3[Services/];
G --> G4[UserControls/];
Z --> Z1[DomainName.Domain.Tests/];
Z --> Z2[DomainName.Application.Tests/];
Z --> Z3[DomainName.Infrastructure.Tests/];
Z --> Z4[DomainName.Presentation.Tests/];
style A fill:#e1f5ff
style B fill:#fff4e1
style Z fill:#ffe1e1
style D fill:#e8f5e9
style E fill:#fff3e0
style F fill:#e3f2fd
style G fill:#f3e5f5
- Domain: Core business entities, models, and domain logic
- Application: Application services, abstractions, and view models
- Infrastructure: External concerns (file I/O, logging, system services)
- Presentation: WinForms UI components, forms, and user controls
Modern Windows Forms application template targeting .NET 8 with enhanced features.
- .NET 8 runtime with latest C# features
- Clean architecture with clear separation of concerns
- Modern dependency injection patterns
- IHostBuilder integration for WinForms
- File and directory provider abstractions
- Navigation service for form management
- User service for system information
- Comprehensive unit testing suite
graph TD;
A[winforms-net8-ef/] --> B[src/];
A --> Z[tests/];
B --> C[DomainName/];
C --> C1[Extensions/];
C --> C2[Program.cs];
B --> D[DomainName.Domain/];
D --> D1[Entities/];
D --> D2[Enumerators/];
D --> D3[Models/];
B --> E[DomainName.Application/];
E --> E1[Abstractions/];
E1 --> E1A[Infrastructure/];
E1A --> E1A1[Persistence/];
E1A --> E1A2[Providers/];
E1A --> E1A3[Services/];
E1 --> E1B[Presentation/];
E1B --> E1B1[Services/];
E --> E2[Extensions/];
E --> E3[ViewModels/];
B --> F[DomainName.Infrastructure/];
F --> F1[Common/];
F --> F2[Extensions/];
F --> F3[Persistence/];
F3 --> F3B[Configurations/];
F --> F4[Providers/];
F --> F5[Services/];
B --> G[DomainName.Presentation/];
G --> G1[Extensions/];
G --> G2[Forms/];
G --> G3[Services/];
G --> G4[UserControls/];
Z --> Z1[DomainName.Domain.Tests/]
Z --> Z2[DomainName.Application.Tests/]
Z --> Z3[DomainName.Infrastructure.Tests/]
Z --> Z4[DomainName.Presentation.Tests/]
style A fill:#e1f5ff
style B fill:#fff4e1
style Z fill:#ffe1e1
style D fill:#e8f5e9
style E fill:#fff3e0
style F fill:#e3f2fd
style G fill:#f3e5f5
style F3 fill:#ffeb3b
- IDirectoryProvider: Directory operations abstraction
- IFileProvider: File system operations
- ILoggerService: Generic logging service
- INavigationService: Form navigation management
- IUserService: User and machine information
Extended WinForms template with Entity Framework Core integration for database operations.
- All features from winforms-net8
- Entity Framework Core with SQLite
- Database context abstraction (IDatabaseContext)
- Migration support
- Automatic database creation on startup
- Connection string configuration
- Development and production environment configurations
graph TD;
A[winforms-net8/] --> B[src/];
A --> Z[tests/];
B --> C[DomainName/];
C --> C1[Extensions/];
C --> C2[Program.cs];
B --> D[DomainName.Domain/];
D --> D1[Enumerators/];
D --> D2[Models/];
B --> E[DomainName.Application/];
E --> E1[Abstractions/];
E1 --> E1A[Infrastructure/];
E1A --> E1A1[Providers/];
E1A --> E1A2[Services/];
E1 --> E1B[Presentation/];
E1B --> E1B1[Services/];
E --> E2[Extensions/];
E --> E3[ViewModels/];
B --> F[DomainName.Infrastructure/];
F --> F1[Extensions/];
F --> F2[Providers/];
F --> F3[Services/];
B --> G[DomainName.Presentation/];
G --> G1[Extensions/];
G --> G2[Forms/];
G --> G3[Services/];
G --> G4[UserControls/];
Z --> Z1[DomainName.Domain.Tests/];
Z --> Z2[DomainName.Application.Tests/];
Z --> Z3[DomainName.Infrastructure.Tests/];
Z --> Z4[DomainName.Presentation.Tests/];
Z4 --> Z4A[Forms/];
Z4A --> Z4A1[MainFormTests.cs];
style A fill:#e1f5ff
style B fill:#fff4e1
style Z fill:#ffe1e1
style D fill:#e8f5e9
style E fill:#fff3e0
style F fill:#e3f2fd
style G fill:#f3e5f5
- Provider: SQLite (configurable)
- Migrations: Stored in Infrastructure assembly
- Lifetime: Singleton by default
- Features:
- Sensitive data logging (Development only)
- Detailed errors
- Command timeout configuration
- Query logging
Modern Windows Presentation Foundation application template with MVVM pattern support.
- WPF with .NET 8
- MVVM architecture support
- Dependency injection for ViewModels and Windows
- IHost integration with WPF Application lifecycle
- Dispatcher-aware exception handling
- Modern UI capabilities
graph TD;
A[wpf-net8/] --> B[src/];
A --> Z[tests/];
B --> C[DomainName/];
C --> C1[Extensions/];
B --> D[DomainName.Domain/];
D --> D1[Enumerators/];
D --> D2[Models/];
B --> E[DomainName.Application/];
E --> E1[Abstractions/];
E1 --> E1A[Infrastructure/];
E1A --> E1A1[Providers/];
E1A --> E1A2[Services/];
E1 --> E1B[Presentation/];
E1B --> E1B1[Services/];
E --> E2[Extensions/];
E --> E3[ViewModels/];
B --> F[DomainName.Infrastructure/];
F --> F1[Extensions/];
F --> F2[Providers/];
F --> F3[Services/];
B --> G[DomainName.Presentation/];
G --> G1[Extensions/];
G --> G2[Services/];
G --> G3[Windows/];
G --> G4[UserControls/];
Z --> Z1[DomainName.Domain.Tests/];
Z --> Z2[DomainName.Application.Tests/];
Z --> Z3[DomainName.Infrastructure.Tests/];
Z --> Z4[DomainName.Presentation.Tests/];
style A fill:#e1f5ff
style B fill:#fff4e1
style Z fill:#ffe1e1
style D fill:#e8f5e9
style E fill:#fff3e0
style F fill:#e3f2fd
style G fill:#f3e5f5
- App.xaml.cs: Application entry point with host configuration
- MainWindow: Primary application window with DI
- Graceful shutdown: Proper host disposal on application exit
- Unhandled exception handling: Centralized error handling
WPF template with Entity Framework Core for data-driven applications.
- All features from wpf-net8
- Entity Framework Core integration
- Database-first or code-first approaches
- Repository pattern support
- Async data operations
graph TD;
A[wpf-net8-ef/] --> B[DomainName/];
A --> C[DomainName.Domain/];
A --> D[DomainName.Application/];
A --> E[DomainName.Infrastructure/];
A --> F[DomainName.Presentation/];
A --> Z[tests/];
B --> B1[Extensions/];
C --> C1[Entities/];
C --> C2[Enumerators/];
C --> C3[Models/];
D --> D1[Interfaces/];
D1 --> D1A[Infrastructure/];
D1A --> D1A1[Persistence/];
D1A --> D1A2[Providers/];
D1A --> D1A3[Services/];
D1 --> D1B[Presentation/];
D1B --> D1B1[Services/];
D --> D2[Extensions/];
D --> D3[ViewModels/];
E --> E1[Common/];
E --> E2[Extensions/];
E --> E3[Persistence/];
E3 --> E3B[Configurations/];
E --> E4[Providers/];
E --> E5[Services/];
F --> F1[Extensions/];
F --> F2[Services/];
F --> F3[Windows/];
F --> F4[UserControls/];
Z --> Z1[DomainName.Domain.Tests/];
Z --> Z2[DomainName.Application.Tests/];
Z --> Z3[DomainName.Infrastructure.Tests/];
Z3 --> Z3A[Installer/];
Z --> Z4[DomainName.Presentation.Tests/];
style A fill:#e1f5ff
style B fill:#fff4e1
style C fill:#e8f5e9
style D fill:#fff3e0
style E fill:#e3f2fd
style F fill:#f3e5f5
style Z fill:#ffe1e1
style E3 fill:#ffeb3b
A specialized template for creating Grand Theft Auto V script modifications using ScriptHookVDotNet.
- ScriptHookVDotNet integration
- Event-driven architecture
- Game provider abstractions
- Audio and screen providers
- World interaction providers
- Clean architecture for game mods
graph TD;
A[GtaMod/] --> B[DomainName/];
A --> C[DomainName.Domain/];
A --> D[DomainName.Application/];
A --> E[DomainName.Infrastructure/];
A --> F[DomainName.Presentation/];
C --> C1[Events/];
C1 --> C1A[System/];
C --> C2[Models/];
D --> D1[Abstractions/];
D1 --> D1A[Application/];
D1A --> D1A1[Providers/];
D1A --> D1A2[Services/];
D1 --> D1B[Infrastructure/];
D1B --> D1B1[Providers/];
D1B --> D1B2[Services/];
D --> D2[Installers/];
D --> D3[Providers/];
D --> D4[Services/];
E --> E1[Installers/]
E --> E2[Providers/]
E --> E3[Services/]
F --> F1[Installers/]
F --> F2[Services/]
style A fill:#e1f5ff
style B fill:#fff4e1
style C fill:#e8f5e9
style D fill:#fff3e0
style E fill:#e3f2fd
style F fill:#f3e5f5
style D3 fill:#ffeb3b
- StartUp: Main script class inheriting from GTA.Script
- Event System:
- TickEvent (game loop)
- KeyDownEvent / KeyUpEvent (input handling)
- AbortedEvent (script termination)
- Providers:
- IAudioProvider: Sound and music control
- IGameProvider: Game state and player information
- IScreenProvider: Screen effects and UI
- IWorldProvider: World manipulation
- GTA V with ScriptHookV
- ScriptHookVDotNet
- .NET Framework or .NET 6+
All templates use Microsoft.Extensions.DependencyInjection for service registration:
services.RegisterServices(context.Configuration, context.HostingEnvironment);Each layer has its own ServiceCollectionExtensions class:
RegisterServices: Register layer-specific servicesRegisterViewModels: Register ViewModels (UI layers)RegisterProviders: Register provider implementations
Templates use the Options pattern with appsettings.json:
hostBuilder.RegisterAppSettingsConfiguration()Generic logging service available across all templates:
ILoggerService<T> // Generic strongly-typed loggerEach layer defines abstractions (interfaces) consumed by other layers:
Abstractions/Infrastructure/: Infrastructure interfacesAbstractions/Application/: Application service interfacesAbstractions/Presentation/: UI service interfaces
All desktop application templates include comprehensive test projects:
- MSTest: Primary testing framework
- Moq: Mocking library for dependencies
- Unit Tests: Isolated component testing
- Integration Tests: Cross-layer testing (where applicable)
- Microsoft.Extensions.DependencyInjection
- Microsoft.Extensions.Hosting
- Microsoft.Extensions.Logging
- Microsoft.Extensions.Configuration
- Microsoft.Extensions.Configuration.Json
- Microsoft.Extensions.Logging.Console
- Microsoft.Extensions.Logging.Debug
- Microsoft.EntityFrameworkCore
- Microsoft.EntityFrameworkCore.Sqlite
- Microsoft.EntityFrameworkCore.Design
- Spectre.Console
- Spectre.Console.Cli
- ScriptHookVDotNet
- Clone the repository:
git clone https://github.com/BoBoBaSs84/Templates.git-
Choose your template and copy the desired template folder
-
Rename the namespace:
- Replace
DomainNamewith your actual domain/project name across all files - Update project references and namespaces
- Configure:
- Update
appsettings.json(if applicable) - Configure connection strings (EF templates)
- Set up project-specific configurations
- Build and run:
dotnet build dotnet runTo install as dotnet templates:
- Create a
template.jsonfile in each template's.template.configfolder - Install template:
dotnet new install ./[TemplatePath]- Dependency Rule: Dependencies point inward (Presentation β Application β Domain)
- Separation of Concerns: Each layer has distinct responsibilities
- Testability: Loose coupling enables comprehensive testing
- Single Responsibility: Classes have one reason to change
- Open/Closed: Open for extension, closed for modification
- Liskov Substitution: Abstractions are properly implemented
- Interface Segregation: Focused, client-specific interfaces
- Dependency Inversion: Depend on abstractions, not concretions
- Repository Pattern (EF templates)
- Options Pattern (configuration)
- Factory Pattern (service creation)
- Provider Pattern (infrastructure abstractions)
- MVVM Pattern (WPF templates)
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning"
}
},
"ConnectionStrings": {
"DefaultConnection": "Data Source=app.db"
}
}IHost host = Host.CreateDefaultBuilder(args)
.RegisterAppSettingsConfiguration()
.ConfigureServices((context, services)
=> services.RegisterServices(context.Configuration, context.HostingEnvironment))
.Build();
host.Run();Contributions are welcome! To contribute:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the repository for details.
BoBoBaSs84
- GitHub: @BoBoBaSs84
- Latest: Includes .NET 8 templates with modern features
- Legacy Support: .NET Framework 4.8 templates maintained
For issues, questions, or suggestions:
- Open an issue on GitHub
- Check existing documentation in template folders
- Review sample implementations in each template
Future template additions may include:
- ASP.NET Core Web API template
- Blazor application template
- MAUI cross-platform template
- Microservices template with Docker support
Last Updated: November 2025