This repository provides .NET C# project templates using the dotnet template system. Templates are defined in templates/content/csharp/CAFSln/.template.config/.
- cafsln: ConsoleAppFramework solution template (with optional data access layer)
- cafc: ConsoleAppFramework console project template
- cafbuild: Build system and CI/CD template
- Build:
dotnet run .build/targets.cs buildor./build.ps1 build - Clean:
dotnet run .build/targets.cs clean - Restore:
dotnet run .build/targets.cs restore - Pack:
dotnet run .build/targets.cs pack
- Run all tests:
dotnet test(test target is placeholder, run directly on test projects) - Run single test:
dotnet test --filter "FullyQualifiedName~TestName" - Test framework: TUnit with Microsoft.Testing.Platform runner
- Pack templates:
dotnet run .build/targets.cs pack(generates nupkg in dist/nuget/) - Install templates locally:
dotnet new install dist/nuget/*.nupkg - Test templates:
dotnet new cafsln --name TestProjectordotnet new cafc --name TestConsole - Test with data access:
dotnet new cafsln --name TestProject --withDataAccess true - Uninstall templates:
dotnet new uninstall henryjs.Net.Templates
- IsSolution: Computed boolean (true for solution template, false for console template)
- withDataAccess: Parameter boolean for including Entity Framework Core data layer
- Use
#if (condition)directives in code for conditional compilation
- Indentation: 4 spaces, no tabs
- Line endings: CRLF
- Final newlines: Not required
- File-scoped namespaces: Preferred
- Braces: Required for all blocks
- Using directives: Outside namespace
- Classes/Types: PascalCase
- Interfaces: IPascalCase
- Methods/Properties: PascalCase
- Parameters/Locals: camelCase
- Private fields: _camelCase
- Constants: PascalCase
- Nullable: Enabled
- Implicit usings: Enabled
- Target framework: .NET 10.0
- Primary constructors: Preferred
- Expression-bodied members: Preferred for accessors, properties, lambdas
- System directives: Sorted first
- Import groups: Separated
- Predefined types: Preferred (string vs String)
- Logging: Serilog with structured logging
- Console apps: ExceptionFilter for global error handling
- Async: Use async/await patterns consistently
- Roslynator analyzers: Enabled for code quality
- EditorConfig: Comprehensive formatting rules applied
- Code coverage: Microsoft.Testing.Extensions.CodeCoverage
The .ai/ directory contains documentation and tools for AI-assisted development:
.ai/designs/template_designs.md: Detailed designs for .NET template project structures.ai/plans.md: Development roadmap and strategic plans.ai/codebase.ps1: PowerShell script to generate codebase documentation for AI analysis
Run the codebase script to create a comprehensive codebase overview:
# From repository root
.\.ai\codebase.ps1This generates .ai/outputs/codebase.txt with directory structure and all source code files.