ApplicationBuilderHelpers 4.1.135

This package has a SemVer 2.0.0 package version: 4.1.135+build.20260910103052.b60105b.
There is a newer version of this package available.
See the version list below for details.
dotnet add package ApplicationBuilderHelpers --version 4.1.135
                    
NuGet\Install-Package ApplicationBuilderHelpers -Version 4.1.135
                    
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.135" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ApplicationBuilderHelpers" Version="4.1.135" />
                    
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.135
                    
#r "nuget: ApplicationBuilderHelpers, 4.1.135"
                    
#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.135
                    
#: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.135
                    
Install as a Cake Addin
#tool nuget:?package=ApplicationBuilderHelpers&version=4.1.135
                    
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, CancellationToken cancellationToken)
    {
        Console.WriteLine($"Hello, {Name}!");
        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, CancellationToken cancellationToken)
    {
        // ...build logic...
    }
}

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

RunAsync returns an exit code:

Outcome Exit code
Run returns normally 0
Run throws CommandException ex.ExitCode
Cancellation (CancellationToken / Ctrl+C) 130 (128 + SIGINT)

Return normally on success. Throw CommandException for errors 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.141 32 9/17/2026
4.1.140 36 9/16/2026
4.1.139 30 9/16/2026
4.1.138 33 9/15/2026
4.1.137 29 9/15/2026
4.1.136 35 9/14/2026
4.1.135 45 9/10/2026
4.1.134 135 9/9/2026
4.1.133 36 9/9/2026
4.1.132 41 9/9/2026
4.1.131 91 9/7/2026
4.1.130 56 9/4/2026
4.1.129 83 8/17/2026
4.1.128 42 8/17/2026
4.1.127 74 8/14/2026
4.1.126 47 8/13/2026
4.1.125 46 8/13/2026
4.1.124 64 8/12/2026
4.1.123 42 8/12/2026
4.1.122 77 8/6/2026
Loading failed

## New Version
* Bump `application_builder_helpers` from `4.1.134` to `4.1.135`. See [changelog](https://github.com/Kiryuumaru/ApplicationBuilderHelpers/compare/application_builder_helpers/4.1.134...application_builder_helpers/4.1.135)

## What's Changed
* refactor: split CommandLineParser god-object (Fixes #375) by @Kiryuumaru in https://github.com/Kiryuumaru/ApplicationBuilderHelpers/pull/398
* cli: map external cancellation to exit 130, keep internal shutdown as success (Fixes #378) by @Kiryuumaru in https://github.com/Kiryuumaru/ApplicationBuilderHelpers/pull/397
* test: comprehensive CLI unit coverage for recent PRs + cross-platform harness fix by @Kiryuumaru in https://github.com/Kiryuumaru/ApplicationBuilderHelpers/pull/399
* feat: add agentic skills ported from NetConduit, generalized to this repo by @Kiryuumaru in https://github.com/Kiryuumaru/ApplicationBuilderHelpers/pull/401
* fix(cli): reject whitespace env values as missing by @Kiryuumaru in https://github.com/Kiryuumaru/ApplicationBuilderHelpers/pull/402
* Bump AbsolutePathHelpers from 0.3.142 to 0.3.143 by @dependabot[bot] in https://github.com/Kiryuumaru/ApplicationBuilderHelpers/pull/404

**Full Changelog**: https://github.com/Kiryuumaru/ApplicationBuilderHelpers/compare/build.20260909173408.a99fa3c...build.20260910103052.b60105b