Codebelt.Extensions.BenchmarkDotNet.Console 1.0.0

dotnet add package Codebelt.Extensions.BenchmarkDotNet.Console --version 1.0.0
                    
NuGet\Install-Package Codebelt.Extensions.BenchmarkDotNet.Console -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Codebelt.Extensions.BenchmarkDotNet.Console" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Codebelt.Extensions.BenchmarkDotNet.Console" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Codebelt.Extensions.BenchmarkDotNet.Console" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Codebelt.Extensions.BenchmarkDotNet.Console --version 1.0.0
                    
#r "nuget: Codebelt.Extensions.BenchmarkDotNet.Console, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Codebelt.Extensions.BenchmarkDotNet.Console@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Codebelt.Extensions.BenchmarkDotNet.Console&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Codebelt.Extensions.BenchmarkDotNet.Console&version=1.0.0
                    
Install as a Cake Tool

Codebelt.Extensions.BenchmarkDotNet.Console

A structured, host-based execution model for running BenchmarkDotNet benchmarks in console applications.

About

Codebelt.Extensions.BenchmarkDotNet.Console extends the Codebelt.Extensions.BenchmarkDotNet package with a dedicated console runner built on the Microsoft Generic Host.

It provides a predictable startup model, consistent dependency injection, and a managed application lifecycle for benchmark execution, aligning benchmarks with the same hosting principles used in modern .NET applications.

By embracing Microsoft.Extensions.Hosting, this package enables clean separation between benchmark definition, configuration, and execution - making benchmarks easier to compose, test, and evolve over time.

At its core, the package favors convention over configuration and promotes benchmarks as first-class, host-managed workloads rather than ad-hoc console routines.

CSharp Example

Benchmarks are executed through a console-hosted Generic Host, allowing full participation in dependency injection, configuration, logging and more.

using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Environments;
using BenchmarkDotNet.Jobs;
using Codebelt.Extensions.BenchmarkDotNet.Console;

public class Program
{
    public static void Main(string[] args)
    {
        BenchmarkProgram.Run(args, o =>
        {
            o.AllowDebugBuild = BenchmarkProgram.IsDebugBuild;
            o.ConfigureBenchmarkDotNet(c =>
            {
                var slimJob = BenchmarkWorkspaceOptions.Slim;
                return c.AddJob(slimJob.WithRuntime(CoreRuntime.Core90))
                    .AddJob(slimJob.WithRuntime(CoreRuntime.Core10_0));
            });
        });
    }
}
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 93 12/12/2025

Version: 1.0.0
Availability: .NET 10 and .NET 9
# New Features
- ADDED BenchmarkContext class in the Codebelt.Extensions.BenchmarkDotNet.Console namespace that represents the command-line context for a benchmark run
- ADDED BenchmarkProgram class in the Codebelt.Extensions.BenchmarkDotNet.Console namespace that provides the main entry point for hosting and running benchmarks using BenchmarkDotNet
- ADDED BenchmarkWorker class in the Codebelt.Extensions.BenchmarkDotNet.Console namespace that is responsible for executing benchmarks within the console host