A comprehensive collection of .NET console application templates with built-in support for Dependency Injection, Configuration (appsettings.json), and Logging (ILogger).
- .NET SDK 8.0 or later (LTS recommended)
- Supports .NET 8.0 (LTS), .NET 9.0 (STS), and .NET 10.0 (LTS, latest)
- ✅ 4 Template Options - From minimal to enterprise
- ✅ .NET 8.0+ Support - Modern .NET with Long-Term Support (net8.0, net9.0, net10.0)
- ✅ Built-in DI - Microsoft.Extensions.DependencyInjection
- ✅ Configuration - appsettings.json with environment-specific overrides
- ✅ Logging - ILogger without third-party dependencies (Serilog optional)
- ✅ Database Support - EF Core or Dapper (SQLite, SQL Server, PostgreSQL)
- ✅ Message Queues - RabbitMQ, Azure Service Bus, Apache Kafka
- ✅ HTTP Client - Typed client with optional Polly resilience (retry, circuit breaker)
- ✅ Health Checks - Monitoring for all dependencies (programmatic or ASP.NET endpoint)
- ✅ CLI Parsing - 3 library options (System.CommandLine, Spectre.Console, CommandLineParser)
- ✅ Docker Ready - Dockerfile + docker-compose with conditional service containers
- ✅ Async/Await Support - Choose between async and sync execution patterns via parameter
- ✅ Selective Generation - Only includes files for features you enable
dotnet new install Inflop.ConsoleApp.Templatesdotnet new install Inflop.ConsoleApp.Templates.1.0.0.nupkgdotnet new listYou should see 4 new templates:
inflop-simple- Console App (Simple)inflop-standard- Console App (Standard)inflop-advanced- Console App (Advanced)inflop-enterprise- Console App (Enterprise)
All templates support both asynchronous and synchronous execution patterns via the --use-async parameter.
- Template 1 (Simple): Synchronous by default (easier for beginners)
- Templates 2, 3, 4 (Standard, Advanced, Enterprise): Asynchronous by default
# Create synchronous version (default)
dotnet new inflop-simple -n MyApp
# Create asynchronous version
dotnet new inflop-simple -n MyApp --use-async true# Create asynchronous version (default - recommended)
dotnet new inflop-standard -n MyApp
dotnet new inflop-advanced -n MyApp
dotnet new inflop-enterprise -n MyApp
# Create synchronous version
dotnet new inflop-standard -n MyApp --use-async false
dotnet new inflop-advanced -n MyApp --use-async false
dotnet new inflop-enterprise -n MyApp --use-async falseUse Async (Recommended for most cases):
- Database operations (EF Core, Dapper)
- HTTP requests (HttpClient)
- Messaging (RabbitMQ, Azure Service Bus, Kafka)
- File I/O operations
- Any I/O-bound operations
Use Sync (Only for specific scenarios):
- CPU-bound operations only
- Simple scripts without I/O
- Learning DI basics without async complexity
- Legacy code integration
Note: The synchronous version uses .GetAwaiter().GetResult() for I/O operations with warning comments, as true synchronous HTTP/database APIs are not available in modern .NET.
Best for: Simple console applications and CLI tools
Features:
- Manual DI container setup (no Generic Host)
- Inline service registration in Program.cs (no extension methods)
- ILogger with console provider
- appsettings.json support
- 3 NuGet packages (absolute minimum for base template)
- Direct service registration for maximum clarity
- More control over lifecycle
Usage:
dotnet new inflop-simple -n MyTool
dotnet new inflop-simple -n MyTool -F net8.0Project Structure:
MyTool/
├── Program.cs (all DI setup + configuration)
├── appsettings.json
├── Services/
│ └── MyService.cs
└── MyTool.csproj
Note: Additional folders (Data/, Infrastructure/, Messaging/, Health/, Extensions/) are generated only when corresponding features are enabled via parameters.
Best for: Standard console applications with medium complexity
Features:
- Generic Host pattern (like ASP.NET Core)
- Built-in ILogger
- appsettings.json with Development override
- BackgroundService pattern
- 2 NuGet packages (minimal dependencies)
Usage:
dotnet new inflop-standard -n MyApp
dotnet new inflop-standard -n MyApp -F net8.0Project Structure:
MyApp/
├── Program.cs
├── appsettings.json
├── appsettings.Development.json
├── Services/
│ ├── AppService.cs
│ └── AppBackgroundService.cs
├── Extensions/ (conditional - only with enabled features)
│ ├── DatabaseExtensions.cs
│ ├── HttpClientExtensions.cs
│ ├── HealthChecksExtensions.cs
│ ├── MessagingExtensions.cs
│ └── CommandLineExtensions.cs
└── MyApp.csproj
Best for: Modern .NET applications with minimal boilerplate
Features:
- Top-level statements (C# 10+)
- Generic Host pattern
- Extension methods for clean DI registration
- Modern C# features (primary constructors)
- 2 NuGet packages
Usage:
dotnet new inflop-advanced -n ModernApp
dotnet new inflop-advanced -n ModernApp -F net8.0Project Structure:
ModernApp/
├── Program.cs (top-level statements)
├── appsettings.json
├── appsettings.Development.json
├── Configuration/ (conditional - with enabled features)
│ ├── DatabaseOptions.cs
│ ├── HttpClientOptions.cs
│ └── MessagingOptions.cs
├── Extensions/
│ ├── ServiceExtensions.cs
│ ├── DatabaseExtensions.cs (conditional)
│ ├── HttpClientExtensions.cs (conditional)
│ ├── HealthChecksExtensions.cs (conditional)
│ ├── MessagingExtensions.cs (conditional)
│ └── CommandLineExtensions.cs (conditional)
├── Services/
│ ├── AppService.cs
│ └── AppWorker.cs
└── ModernApp.csproj
Best for: Enterprise applications with complex requirements
Features:
- Strongly-typed configuration (Options pattern)
- Multiple background workers
- Environment-specific configuration (Development, Production)
- Structured logging with configurable levels
- Retry logic and error handling patterns
- 5 NuGet packages
Usage:
dotnet new inflop-enterprise -n EnterpriseApp
dotnet new inflop-enterprise -n EnterpriseApp -F net8.0Project Structure:
EnterpriseApp/
├── Program.cs
├── appsettings.json
├── appsettings.Development.json
├── appsettings.Production.json
├── Configuration/
│ ├── AppSettings.cs
│ ├── WorkerSettings.cs
│ └── ServiceConfiguration.cs
├── Extensions/ (conditional - only with enabled features)
│ ├── DatabaseExtensions.cs
│ ├── HttpClientExtensions.cs
│ ├── HealthChecksExtensions.cs
│ ├── MessagingExtensions.cs
│ └── CommandLineExtensions.cs
├── Services/
│ ├── IAppService.cs
│ ├── AppService.cs
│ ├── IDataProcessor.cs
│ ├── DataProcessor.cs
│ ├── PrimaryWorker.cs
│ └── SecondaryWorker.cs
└── EnterpriseApp.csproj
All templates support optional parameters for adding enterprise features:
Add database support with Entity Framework Core or Dapper:
# EF Core with SQLite (default)
dotnet new inflop-advanced -n MyApp --add-database efcore
# Dapper with PostgreSQL
dotnet new inflop-advanced -n MyApp --add-database dapper --database-type postgres
# EF Core with SQL Server
dotnet new inflop-enterprise -n MyApp --add-database efcore --database-type sqlserverOptions:
none- No database (default)dapper- Lightweight ORM (Factory Pattern)efcore- Entity Framework Core
Database Types (--database-type):
sqlite- File-based, no external dependencies (default)sqlserver- SQL Serverpostgres- PostgreSQL
What's Included:
- ✅ Repository pattern (
IExampleRepository) - ✅ Example entity (
ExampleEntity) - ✅ Connection factories (Dapper) or DbContext (EF Core)
- ✅ Configured connection strings in
appsettings.json
Add typed HttpClient with optional Polly resilience:
# Basic HttpClient
dotnet new inflop-advanced -n MyApp --add-httpclient basic
# With Polly (retry + circuit breaker)
dotnet new inflop-enterprise -n MyApp --add-httpclient with-pollyOptions:
none- No HTTP client (default)basic- Basic typed HttpClientwith-polly- Resilient client with retry, circuit breaker, and timeout
What's Included:
- ✅
IApiClientinterface and implementation - ✅ Configured base URL and timeout
- ✅ Polly policies: exponential retry (3x), circuit breaker, timeout
Add health monitoring for your application and dependencies:
# Programmatic health checks
dotnet new inflop-advanced -n MyApp --add-healthchecks basic
# With ASP.NET endpoint at /health
dotnet new inflop-enterprise -n MyApp --add-healthchecks aspnetOptions:
none- No health checks (default)basic- Programmatic health checksaspnet- Health checks with HTTP endpoint
What's Included:
- ✅ Custom health check example
- ✅ Automatic checks for database, messaging, and HTTP dependencies
- ✅ ASP.NET endpoint at
/health(aspnet mode)
Add message consumer/publisher for distributed systems:
# RabbitMQ
dotnet new inflop-advanced -n Worker --add-messaging rabbitmq
# Azure Service Bus
dotnet new inflop-enterprise -n Worker --add-messaging azureservicebus
# Apache Kafka
dotnet new inflop-advanced -n Worker --add-messaging kafkaOptions:
none- No messaging (default)rabbitmq- RabbitMQazureservicebus- Azure Service Buskafka- Apache Kafka
What's Included:
- ✅
IMessageConsumerandIMessagePublisherinterfaces - ✅ Provider-specific implementations
- ✅ Continuous consumer pattern
- ✅ ACK/NACK handling and retry logic
- ✅ Configuration in
appsettings.json
Add argument parsing with your choice of library:
# Microsoft official (System.CommandLine)
dotnet new inflop-simple -n MyTool --add-commandline system-commandline
# Rich console UI (Spectre.Console)
dotnet new inflop-advanced -n MyTool --add-commandline spectre-console
# Attribute-based (CommandLineParser)
dotnet new inflop-simple -n MyTool --add-commandline command-line-parserOptions:
none- No CLI parsing (default)system-commandline- System.CommandLine (Microsoft)spectre-console- Spectre.Console (rich UI)command-line-parser- CommandLineParser (attributes)
What's Included:
- ✅
CommandLineOptionsclass - ✅ Parsing extensions for each library
- ✅ Example options:
--name,--verbose - ✅ Integration in
Program.cs
Add containerization with Docker:
dotnet new inflop-advanced -n MyApp --add-dockerWhat's Included:
- ✅
Dockerfilewith multi-stage build - ✅
.dockerignorefile - ✅
docker-compose.ymlwith conditional services:- Database containers (SQL Server, PostgreSQL)
- Message queue containers (RabbitMQ, Kafka + Zookeeper)
Add Serilog for structured logging:
dotnet new inflop-advanced -n MyApp --add-serilogWhat's Included:
- ✅ Serilog with Console and File sinks
- ✅ Configured via
appsettings.json - ✅ Structured logging with context
dotnet new inflop-advanced -n OrderProcessor \
--add-database efcore -D postgres \
--add-messaging rabbitmq \
--add-healthchecks aspnet \
--add-docker \
--add-serilogGenerates:
- PostgreSQL with EF Core repository
- RabbitMQ consumer/publisher
- Health checks with
/healthendpoint - Docker Compose with Postgres + RabbitMQ
- Structured logging (Serilog)
dotnet new inflop-enterprise -n ApiClient \
--add-httpclient with-polly \
--add-commandline system-commandline \
--add-healthchecks basic \
--add-serilogGenerates:
- Resilient HTTP client (retry + circuit breaker)
- Command-line argument parsing
- Health checks for API endpoint
- Serilog logging
dotnet new inflop-advanced -n DataPipeline \
--add-database dapper -D sqlserver \
--add-httpclient with-polly \
--add-messaging kafka \
--add-dockerGenerates:
- SQL Server with Dapper
- Resilient HTTP client
- Kafka consumer/publisher
- Docker Compose
| Feature | Simple | Standard | Advanced | Enterprise |
|---|---|---|---|---|
| Template ID | inflop-simple |
inflop-standard |
inflop-advanced |
inflop-enterprise |
| Base NuGet Packages | 3 | 2 | 2 | 5 |
| DI Container | Manual ServiceCollection | Generic Host | Generic Host | Generic Host |
| Code Style | Traditional | Traditional | Top-Level Statements | Traditional |
| Service Registration | Inline in Program.cs | Extension methods | Extension methods | Centralized config class |
| ILogger | ✅ | ✅ | ✅ | ✅ |
| appsettings.json | ✅ | ✅ | ✅ | ✅ |
| Environment Config | ❌ | Dev | Dev | Dev + Prod |
| Strongly-Typed Config | ❌ | ❌ | Partial (Options) | ✅ (Options pattern) |
| Background Workers | ❌ | 1 (BackgroundService) | 1 (Worker) | 2 (Primary + Secondary) |
| Retry Logic | ❌ | ❌ | ❌ | ✅ |
| Default Async | ❌ (sync) | ✅ (async) | ✅ (async) | ✅ (async) |
| Complexity | Very Low | Low | Low-Medium | Medium-High |
| Best For | CLI tools, simple scripts | Standard apps, services | Modern .NET apps | Enterprise solutions |
| Parameter | Options | Description |
|---|---|---|
--add-database |
none, dapper, efcore | Database access layer |
--database-type |
sqlite, sqlserver, postgres | Database engine |
--add-httpclient |
none, basic, with-polly | Typed HTTP client |
--add-healthchecks |
none, basic, aspnet | Health monitoring |
--add-messaging |
none, rabbitmq, azureservicebus, kafka | Message queue |
--add-commandline |
none, system-commandline, spectre-console, command-line-parser | CLI parsing |
--add-docker |
true, false | Docker support |
--add-serilog |
true, false | Structured logging |
--use-async |
true, false | Use async/await pattern |
All templates support .NET 8.0 (LTS), 9.0 (STS), and 10.0 (LTS, latest). Specify the target framework during creation:
# Default (net8.0 LTS - Recommended)
dotnet new inflop-simple -n MyApp
# .NET 8.0 (LTS) - Explicitly specified
dotnet new inflop-simple -n MyApp -F net8.0
# .NET 9.0 (STS)
dotnet new inflop-simple -n MyApp -F net9.0
# .NET 10.0 (LTS, Latest)
dotnet new inflop-simple -n MyApp -F net10.0Note: Templates require .NET 8.0 or later. .NET 6.0 and 7.0 are no longer supported as they have reached end-of-life.
# Create project
dotnet new inflop-simple -n MyTool
# Navigate to project
cd MyTool
# Run application
dotnet run# Create project with .NET 8.0
dotnet new inflop-standard -n MyApp -F net8.0
# Navigate and run
cd MyApp
dotnet run# Create project
dotnet new inflop-advanced -n ModernApp
# Navigate and run in Development
cd ModernApp
dotnet run --environment Development# Create project with .NET 8.0
dotnet new inflop-enterprise -n MyEnterpriseApp -F net8.0
# Navigate and run
cd MyEnterpriseApp
# Run in Development
dotnet run --environment Development
# Run in Production
dotnet run --environment ProductionIf you want to build the package yourself:
# Navigate to template root
cd Inflop.ConsoleApp.Templates
# Pack the template
dotnet pack -c Release
# Install locally
dotnet new install bin/Release/Inflop.ConsoleApp.Templates.1.0.0.nupkg# Uninstall by package name
dotnet new uninstall Inflop.ConsoleApp.Templates
# Uninstall by path (if installed from .nupkg)
dotnet new uninstall /path/to/Inflop.ConsoleApp.Templates.1.0.0.nupkg// Inject IConfiguration
public class MyService
{
private readonly IConfiguration _configuration;
public MyService(IConfiguration configuration)
{
_configuration = configuration;
}
public void DoWork()
{
var setting = _configuration["MySetting"];
var nestedSetting = _configuration["Section:NestedSetting"];
}
}// Configuration class
public class MySettings
{
public string ApiUrl { get; set; }
public int Timeout { get; set; }
}
// Register in Program.cs
builder.Services.Configure<MySettings>(
builder.Configuration.GetSection("MySettings"));
// Inject in service
public class MyService
{
private readonly MySettings _settings;
public MyService(IOptions<MySettings> settings)
{
_settings = settings.Value;
}
}# Via environment variable
export DOTNET_ENVIRONMENT=Development
dotnet run
# Via command-line argument
dotnet run --environment Production
# Via launchSettings.json (Development only)
# Edit Properties/launchSettings.jsonappsettings.json- Base configurationappsettings.{Environment}.json- Environment-specific overrides- Environment variables
- Command-line arguments
If you want to use Serilog for advanced logging:
# Add Serilog packages
dotnet add package Serilog
dotnet add package Serilog.Extensions.Hosting
dotnet add package Serilog.Sinks.Console// In Program.cs
using Serilog;
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Information()
.WriteTo.Console()
.CreateLogger();
builder.Logging.ClearProviders();
builder.Logging.AddSerilog(Log.Logger, dispose: true);All templates follow modern software development practices:
- Dependency Injection - Loose coupling and testability
- SOLID Principles - Single Responsibility, Open/Closed, Interface Segregation, Dependency Inversion
- Configuration over Code - Settings in appsettings.json
- Clean Code - Readable and maintainable
- GitHub Issues: https://github.com/inflop/Inflop.ConsoleApp.Templates/issues
- License: MIT
- ✅ 4 console application templates (Simple, Standard, Advanced, Enterprise)
- ✅ Multi-version support (.NET 8.0, 9.0, 10.0)
- ✅ 8 advanced parameters for enterprise features:
- Database access (EF Core, Dapper) with 3 DB engines
- Message queues (RabbitMQ, Azure Service Bus, Kafka)
- HTTP client with Polly resilience
- Health checks with automatic dependency monitoring
- CLI parsing (3 library options)
- Docker + docker-compose
- Serilog structured logging
- ✅ Selective file generation (only includes what you need)
MIT License - See LICENSE file for details
This project was created with the support of Claude Code - Anthropic's official CLI for Claude.