ApplicationBuilderHelpers 4.1.88

This package has a SemVer 2.0.0 package version: 4.1.88+build.20260617101205.a4e4a17.
There is a newer version of this package available.
See the version list below for details.
dotnet add package ApplicationBuilderHelpers --version 4.1.88
                    
NuGet\Install-Package ApplicationBuilderHelpers -Version 4.1.88
                    
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="ApplicationBuilderHelpers" Version="4.1.88" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ApplicationBuilderHelpers" Version="4.1.88" />
                    
Directory.Packages.props
<PackageReference Include="ApplicationBuilderHelpers" />
                    
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 ApplicationBuilderHelpers --version 4.1.88
                    
#r "nuget: ApplicationBuilderHelpers, 4.1.88"
                    
#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 ApplicationBuilderHelpers@4.1.88
                    
#: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=ApplicationBuilderHelpers&version=4.1.88
                    
Install as a Cake Addin
#tool nuget:?package=ApplicationBuilderHelpers&version=4.1.88
                    
Install as a Cake Tool

ApplicationBuilderHelpers

A .NET library for building command-line applications with a fluent API, dependency injection, and modular architecture.

  • Targets: net6.0โ€“net10.0 ยท AOT compatible ยท Trimmable
  • Dependencies: Microsoft.Extensions.Hosting, Microsoft.Extensions.DependencyInjection.Abstractions, AbsolutePathHelpers

Features

  • ๐ŸŽฏ Command-based Architecture โ€” Command patterns with automatic argument parsing
  • ๐Ÿ”ง Fluent Builder API โ€” Intuitive setup via method chaining
  • ๐Ÿ’‰ Dependency Injection โ€” Full Microsoft.Extensions.DependencyInjection support
  • ๐Ÿ—๏ธ Modular Application Structure โ€” Reusable ApplicationDependency modules with lifecycle hooks
  • โš™๏ธ Configuration โ€” .NET configuration integration with @ref: reference values
  • ๐ŸŽจ Attributes โ€” [Command], [CommandOption], [CommandArgument] for declarative CLI definitions
  • ๐ŸŽฏ Sub-Commands โ€” Hierarchical commands via space-separated names
  • ๐Ÿ–Œ๏ธ Themable Help โ€” 5 built-in console color themes, configurable help width
  • ๐Ÿงฉ Multiple Host Types โ€” HostApplicationBuilder, WebApplicationBuilder, custom builders

Installation

dotnet add package ApplicationBuilderHelpers

Quick Start

// Program.cs
using ApplicationBuilderHelpers;

return await ApplicationBuilder.Create()
    .AddApplication<CoreApplication>()
    .AddCommand<GreetCommand>()
    .RunAsync(args);
[Command(description: "Greet someone")]
public class GreetCommand : Command
{
    [CommandArgument(Name = "name", Position = 0, Description = "Who to greet")]
    public string Name { get; set; } = "World";

    protected override ValueTask Run(ApplicationHost<HostApplicationBuilder> applicationHost, CancellationTokenSource cts)
    {
        Console.WriteLine($"Hello, {Name}!");
        cts.Cancel();
        return ValueTask.CompletedTask;
    }
}
$ myapp Alice
Hello, Alice!

Core Concepts

Commands

Extend Command and override Run. Define options with [CommandOption] and positional arguments with [CommandArgument]. Commands can register their own services, middleware, and configuration โ€” they inherit the full ApplicationDependency lifecycle.

[Command("build", description: "Build the project")]
public class BuildCommand : Command
{
    [CommandOption('v', "verbose", Description = "Enable verbose output")]
    public bool Verbose { get; set; }

    protected override async ValueTask Run(ApplicationHost<HostApplicationBuilder> applicationHost, CancellationTokenSource cts)
    {
        // ...build logic...
        cts.Cancel();
    }
}

ApplicationDependency

Group shared services and configuration into reusable modules:

public class CoreApplication : ApplicationDependency
{
    public override void AddServices(ApplicationHostBuilder appBuilder, IServiceCollection services)
    {
        services.AddSingleton<IMyService, MyService>();
    }
}

See Application Dependencies for the full lifecycle reference.

Sub-Commands

Use space-separated names for hierarchical commands. Try myapp deploy prod or myapp deploy prod rollback:

[Command("deploy prod", description: "Deploy to production")]
public class DeployProductionCommand : Command { /* ... */ }

Exit Codes

Throw CommandException to return a non-zero exit code from RunAsync:

throw new CommandException("Operation failed", exitCode: 1);

See Advanced Topics for more on sub-commands, custom host types, and error handling.

Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  ApplicationBuilder โ”‚ โ† Entry Point (fluent API)
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
           โ”‚
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚  Commands   โ”‚ โ† Command Registration (+ own lifecycle hooks)
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜
           โ”‚
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚  Applications   โ”‚ โ† Application Modules (lifecycle hooks)
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
           โ”‚
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚  Host Builder    โ”‚ โ† Host Configuration
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
           โ”‚
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚  Services   โ”‚ โ† Dependency Injection
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜
           โ”‚
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚  Middleware     โ”‚ โ† Request Pipeline
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
           โ”‚
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚  Execution  โ”‚ โ† Command Execution
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Documentation

Guide
Getting Started Installation, first app, services
Commands Attributes, options, arguments, lifecycle
Application Dependencies Full lifecycle reference
Configuration & Themes Fluent config, themes, @ref: system, help formatting
Custom Type Parsers ICommandTypeParser / CommandTypeParser<T>
Advanced Topics Sub-commands, host types, exit codes, error handling
API Reference Complete public API surface

Contributing

Contributions are welcome! Please submit a Pull Request.

License

MIT โ€” see the LICENSE file.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  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
4.1.89 21 6/17/2026
4.1.88 20 6/17/2026
4.1.87 29 6/17/2026
4.1.86 115 6/12/2026
4.1.85 30 6/12/2026
4.1.84 76 6/11/2026
4.1.83 34 6/11/2026
4.1.82 83 6/10/2026
4.1.81 38 6/10/2026
4.1.80 137 6/2/2026
4.1.79 90 5/29/2026
4.1.78 60 5/29/2026
4.1.77 91 5/27/2026
4.1.76 65 5/27/2026
4.1.75 155 5/19/2026
4.1.74 77 5/19/2026
4.1.73 80 5/18/2026
4.1.72 110 5/15/2026
4.1.71 78 5/15/2026
4.1.70 125 5/14/2026
Loading failed