![]() |
VOOZH | about |
dotnet add package Codebelt.Bootstrapper.Console --version 5.1.1
NuGet\Install-Package Codebelt.Bootstrapper.Console -Version 5.1.1
<PackageReference Include="Codebelt.Bootstrapper.Console" Version="5.1.1" />
<PackageVersion Include="Codebelt.Bootstrapper.Console" Version="5.1.1" />Directory.Packages.props
<PackageReference Include="Codebelt.Bootstrapper.Console" />Project file
paket add Codebelt.Bootstrapper.Console --version 5.1.1
#r "nuget: Codebelt.Bootstrapper.Console, 5.1.1"
#:package Codebelt.Bootstrapper.Console@5.1.1
#addin nuget:?package=Codebelt.Bootstrapper.Console&version=5.1.1Install as a Cake Addin
#tool nuget:?package=Codebelt.Bootstrapper.Console&version=5.1.1Install as a Cake Tool
An open-source family of assemblies (MIT license) that provide a uniform and consistent way of bootstraping your code with Program.cs paired with Startup.cs.
Also, common for all, is the implementation of the IHostedService interface; this means that all project types, including the traditional console, now have option for graceful shutdown should your application require this (cronjob scenarios or similar).
Your versatile Bootstrapper companion for modern development with .NET 9 and .NET 10.
It is, by heart, free, flexible and built to extend and boost your agile codebelt.
An implementation optimized for console applications.
An example on how to use Codebelt.Bootstrapper.Console in C#:
// --- Program.cs ---
public class Program : ConsoleProgram<Startup>
{
static async Task Main(string[] args)
{
await CreateHostBuilder(args)
.Build()
.RunAsync()
.ConfigureAwait(false);
}
}
// --- Startup.cs ---
public class Startup : ConsoleStartup
{
public Startup(IConfiguration configuration, IHostEnvironment environment) : base(configuration, environment)
{
}
public override void ConfigureServices(IServiceCollection services)
{
services.AddSingleton<ICorrelationToken>(new CorrelationToken());
}
public override void ConfigureConsole(IServiceProvider serviceProvider)
{
var logger = serviceProvider.GetRequiredService<ILogger<Startup>>();
BootstrapperLifetime.OnApplicationStartedCallback = () => logger.LogInformation("Started");
BootstrapperLifetime.OnApplicationStoppingCallback = () =>
{
logger.LogWarning("Stopping and cleaning ..");
Thread.Sleep(TimeSpan.FromSeconds(5)); // simulate graceful shutdown
logger.LogWarning(".. done!");
};
BootstrapperLifetime.OnApplicationStoppedCallback = () => logger.LogCritical("Stopped");
}
public async override Task RunAsync(IServiceProvider serviceProvider, CancellationToken cancellationToken)
{
var logger = serviceProvider.GetRequiredService<ILogger<Startup>>();
logger.LogInformation("Guid: {Guid}", serviceProvider.GetRequiredService<ICorrelationToken>());
for (int dots = 0; dots <= 5; ++dots)
{
if (cancellationToken.IsCancellationRequested) { return; }
System.Console.Write($"\rFire and forget {Generate.FixedString('.', dots)}");
await Task.Delay(500, cancellationToken).ConfigureAwait(false);
}
System.Console.WriteLine("\nDone and done!");
}
}
And the minimal equivalent example on how to use Codebelt.Bootstrapper.Console in C#:
// --- Program.cs ---
public class Program : MinimalConsoleProgram
{
static Task Main(string[] args)
{
var builder = CreateHostBuilder(args);
builder.Services.AddSingleton<ICorrelationToken>(new CorrelationToken());
var host = builder.Build();
var logger = host.Services.GetRequiredService<ILogger<Program>>();
BootstrapperLifetime.OnApplicationStartedCallback = () => logger.LogWarning("Console started.");
BootstrapperLifetime.OnApplicationStoppingCallback = () =>
{
logger.LogWarning("Stopping and cleaning ..");
Thread.Sleep(TimeSpan.FromSeconds(5)); // simulate graceful shutdown
logger.LogWarning(".. done!");
};
BootstrapperLifetime.OnApplicationStoppedCallback = () => logger.LogCritical("Console stopped.");
return host.RunAsync();
}
public async override Task RunAsync(IServiceProvider serviceProvider, CancellationToken cancellationToken)
{
var logger = serviceProvider.GetRequiredService<ILogger<Program>>();
logger.LogInformation("Guid: {Guid}", serviceProvider.GetRequiredService<ICorrelationToken>());
for (int dots = 0; dots <= 5; ++dots)
{
if (cancellationToken.IsCancellationRequested) { return; }
System.Console.Write($"\rFire and forget {Generate.FixedString('.', dots)}");
await Task.Delay(500, cancellationToken).ConfigureAwait(false);
}
System.Console.WriteLine("\nDone and done!");
}
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 1 NuGet packages that depend on Codebelt.Bootstrapper.Console:
| Package | Downloads |
|---|---|
|
Codebelt.Extensions.BenchmarkDotNet.Console
The Codebelt.Extensions.BenchmarkDotNet.Console namespace contains types that provide a structured and opinionated console-hosted execution model for BenchmarkDotNet. |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 5.1.1 | 99 | 6/7/2026 |
| 5.1.0 | 309 | 5/27/2026 |
| 5.0.7 | 204 | 4/18/2026 |
| 5.0.6 | 553 | 3/29/2026 |
| 5.0.5 | 344 | 3/1/2026 |
| 5.0.4 | 329 | 2/21/2026 |
| 5.0.3 | 351 | 2/15/2026 |
| 5.0.2 | 1,237 | 12/17/2025 |
| 5.0.1 | 551 | 12/7/2025 |
| 5.0.0 | 246 | 11/14/2025 |
| 4.0.5 | 344 | 9/15/2025 |
| 4.0.4 | 208 | 8/20/2025 |
| 4.0.3 | 222 | 7/11/2025 |
| 4.0.2 | 238 | 6/16/2025 |
| 4.0.1 | 246 | 5/25/2025 |
| 4.0.0 | 264 | 4/12/2025 |
| 3.0.1 | 220 | 1/31/2025 |
| 3.0.0 | 189 | 11/13/2024 |
| 3.0.0-rc.1 | 140 | 11/11/2024 |
| 3.0.0-preview.2 | 144 | 10/13/2024 |
Version: 5.1.1
Availability: .NET 10 and .NET 9
# ALM
- CHANGED Dependencies have been upgraded to the latest compatible versions for all supported target frameworks (TFMs)
Version: 5.1.0
Availability: .NET 10 and .NET 9
# ALM
- CHANGED Dependencies have been upgraded to the latest compatible versions for all supported target frameworks (TFMs)
Version: 5.0.7
Availability: .NET 10 and .NET 9
# ALM
- CHANGED Dependencies have been upgraded to the latest compatible versions for all supported target frameworks (TFMs)
Version: 5.0.6
Availability: .NET 10 and .NET 9
# ALM
- CHANGED Dependencies have been upgraded to the latest compatible versions for all supported target frameworks (TFMs)
Version: 5.0.5
Availability: .NET 10 and .NET 9
# ALM
- CHANGED Dependencies have been upgraded to the latest compatible versions for all supported target frameworks (TFMs)
Version: 5.0.4
Availability: .NET 10 and .NET 9
# ALM
- CHANGED Dependencies have been upgraded to the latest compatible versions for all supported target frameworks (TFMs)
Version: 5.0.3
Availability: .NET 10 and .NET 9
# ALM
- CHANGED Dependencies have been upgraded to the latest compatible versions for all supported target frameworks (TFMs)
Version: 5.0.2
Availability: .NET 10 and .NET 9
# ALM
- CHANGED Dependencies have been upgraded to the latest compatible versions for all supported target frameworks (TFMs)
# Bug Fixes
- FIXED MinimalConsoleProgram class in the Codebelt.Bootstrapper.Console namespace so it also supports generics like its ConsoleProgram counterpart (but limited to ProgramRoot)
Version: 5.0.1
Availability: .NET 10 and .NET 9
# ALM
- CHANGED Dependencies have been upgraded to the latest compatible versions for all supported target frameworks (TFMs)
# Bug Fixes
- FIXED ConsoleHostedService class in the Codebelt.Bootstrapper.Console namespace to properly handle suppression of host lifetime status messages when configured to do so
- FIXED MinimalConsoleHostedService class in the Codebelt.Bootstrapper.Console namespace to properly handle suppression of host lifetime status messages when configured to do so
Version: 5.0.0
Availability: .NET 10 and .NET 9
# ALM
- ADDED Support for TFM .NET 10 (LTS)
- REMOVED Support for TFM .NET 8 (LTS)
- CHANGED Dependencies have been upgraded to the latest compatible versions for all supported target frameworks (TFMs)
Version: 4.0.6
Availability: .NET 9 and .NET 8
# ALM
- CHANGED Dependencies have been upgraded to the latest compatible versions for all supported target frameworks (TFMs)
Version: 4.0.5
Availability: .NET 9 and .NET 8
# ALM
- CHANGED Dependencies have been upgraded to the latest compatible versions for all supported target frameworks (TFMs)
Version: 4.0.4
Availability: .NET 9 and .NET 8
# ALM
- CHANGED Dependencies have been upgraded to the latest compatible versions for all supported target frameworks (TFMs)
Version: 4.0.3
Availability: .NET 9 and .NET 8
# ALM
- CHANGED Dependencies have been upgraded to the latest compatible versions for all supported target frameworks (TFMs)
Version: 4.0.2
Availability: .NET 9 and .NET 8
# ALM
- CHANGED Dependencies have been upgraded to the latest compatible versions for all supported target frameworks (TFMs)
Version: 4.0.1
Availability: .NET 9 and .NET 8
# ALM
- CHANGED Dependencies have been upgraded to the latest compatible versions for all supported target frameworks (TFMs)
Version: 4.0.0
Availability: .NET 9 and .NET 8
# ALM
- CHANGED Dependencies to latest and greatest with respect to TFMs
# Breaking Changes
- CHANGED UseBootstrapperProgram method on the HostApplicationBuilderExtensions class in the Codebelt.Bootstrapper.Console namespace to extend IHostApplicationBuilder instead of HostApplicationBuilder
- CHANGED UseMinimalConsoleProgram method on the HostApplicationBuilderExtensions class in the Codebelt.Bootstrapper.Console namespace to extend IHostApplicationBuilder instead of HostApplicationBuilder
Version: 3.0.1
Availability: .NET 9 and .NET 8
# ALM
- CHANGED Dependencies to latest and greatest with respect to TFMs
Version: 3.0.0
Availability: .NET 9 and .NET 8
# ALM
- CHANGED Dependencies to latest and greatest with respect to TFMs
- REMOVED Support for TFM .NET 6 (LTS)
# Breaking Changes
- REMOVED Run (abstract method) from the ConsoleStartup class located in the Codebelt.Bootstrapper.Console namespace
- REMOVED ILogger{TStartup} argument from the ConsoleHostedService class in the Codebelt.Bootstrapper.Console namespace
# New Features
- ADDED RunAsync (abstract method) to the ConsoleStartup class in the Codebelt.Bootstrapper.Console namespace
- ADDED ConfigureConsole (virtual method) to the ConsoleStartup class in the Codebelt.Bootstrapper.Console namespace
- ADDED HostApplicationBuilderExtensions class in the Codebelt.Bootstrapper.Console namespace that consist of extension methods for the HostApplicationBuilder class: UseBootstrapperProgram and UseMinimalConsoleProgram
- ADDED IProgramFactory interface in the Codebelt.Bootstrapper.Console namespace that provides an interface for initializing services and middleware used by an application
- ADDED MinimalConsoleHostedService class in the Codebelt.Bootstrapper.Console namespace that provides a console application that is managed by its host
- ADDED MinimalConsoleProgram class in the Codebelt.Bootstrapper.Console namespace that provides the base entry point of an application optimized for console applications
- ADDED ProgramFactory class in the Codebelt.Bootstrapper.Console namespace that is the default implementation of IProgramFactory
# Improvements
- CHANGED ConsoleHostedService class in the Codebelt.Bootstrapper.Console namespace to provide a significantly better developer experience
Version: 2.0.0
Availability: .NET 6.0 and .NET 8.0
# ALM
- REMOVED TFM for net7.0
- CHANGED Dependencies to latest and greatest with respect to TFMs
Version: 1.3.0
Availability: .NET 6.0, .NET 7.0, .NET 8.0
# ALM
- CHANGED Dependencies to latest and greatest
Version: 1.2.0
Availability: .NET 6.0, .NET 7.0, .NET 8.0
# ALM
- ADDED TFM for net8.0
- CHANGED Dependencies to latest and greatest with respect to TFMs
Version: 1.1.0
Availability: .NET 6.0, .NET 7.0
# ALM
- ADDED TFM for .NET 7
- CHANGED Dependencies to latest and greatest with respect to TFM
Version: 1.0.1
Availability: .NET 5.0, .NET 6.0
# ALM
- ADDED TFM for .NET 6
- CHANGED Dependencies to latest and greatest with respect to TFM
# Breaking Changes
- CHANGED namespace from Codebelt.Bootstrapper.Common to Codebelt.Bootstrapper.Console
# Bug Fixes
- FIXED non-critical bug in the ConsoleHostedService class located in the Codebelt.Bootstrapper.Console namespace
Version: 1.0.0
Availability: .NET 5.0
# New Features
- ADDED ConsoleHostedService class in the Codebelt.Bootstrapper.Common namespace that provides a console application that is managed by its host
- ADDED ConsoleProgram class in the Codebelt.Bootstrapper.Common namespace that is the base entry point of an application responsible for registering its ConsoleStartup partner
- ADDED ConsoleStartup interface in the Codebelt.Bootstrapper.Common namespace that provides the base class of a conventional based Startup class for a console application
- ADDED HostBuilderExtensions class in the Codebelt.Bootstrapper.Common namespace that consist of extension methods for the IHostBuilder interface: UseConsoleStartup