ApplicationBuilderHelpers 4.1.143
dotnet add package ApplicationBuilderHelpers --version 4.1.143
NuGet\Install-Package ApplicationBuilderHelpers -Version 4.1.143
<PackageReference Include="ApplicationBuilderHelpers" Version="4.1.143" />
<PackageVersion Include="ApplicationBuilderHelpers" Version="4.1.143" />
<PackageReference Include="ApplicationBuilderHelpers" />
paket add ApplicationBuilderHelpers --version 4.1.143
#r "nuget: ApplicationBuilderHelpers, 4.1.143"
#:package ApplicationBuilderHelpers@4.1.143
#addin nuget:?package=ApplicationBuilderHelpers&version=4.1.143
#tool nuget:?package=ApplicationBuilderHelpers&version=4.1.143
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.DependencyInjectionsupport - ๐๏ธ Modular Application Structure โ Reusable
ApplicationDependencymodules 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!
A near-miss of a subcommand name still exits 2. Use -- to force positional binding (myapp -- 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 (also --help / --version) |
0 (conversion failure beats help-with-values; invalid+version still 0 via the pre-validation version guard at CommandLineParser.cs:78-82; leading --help/-h on a concrete root renders global help, exit 0, before trailing validation โ IsConcreteRootLeadingHelp at ArgumentParser.cs:530-537, pinned by RootRoutingDivergenceTests.cs) |
Usage / validation error (UnknownOption, MissingRequired, RequiresSubcommand, InvalidValue, UnknownCommand; DuplicateOption is reserved and never thrown โ valued repeats resolve last-wins) |
2 |
Unexpected fault (Fault, NoImplementation, or Run throwing CommandException with a custom code) |
1 or ex.ExitCode (custom host-code passthrough preserved) |
Cancellation (CancellationToken / Ctrl+C) |
130 (128 + SIGINT) |
Bare root (no root implementation, only leaf subcommands): myapp with zero args exits 2 with '<root>' requires a subcommand. Available subcommands: ... plus the two-sentence global usage footer (SubCommandInfo.cs:32; ArgumentParser.cs:76-96; CommandErrorFooter.cs:21-58). Help-first (myapp --help greet) renders global help, exit 0 (ArgumentParser.cs:47-62; HelpFormatter.cs:40-42) โ and on a concrete root (a description-only [Command] merged at root, HasImplementation true) a leading bare --help/-h renders global help before trailing validation, exit 0 (IsConcreteRootLeadingHelp at ArgumentParser.cs:530-537; version still beats help) โ see Advanced Topics.
Return normally on success. Throw CommandException for errors to return a non-zero exit code from RunAsync:
throw new CommandException("Operation failed", exitCode: 1);
Shell completion (complete / completions ...) resolves through the CompletionGateway pre-parse stage first โ see Commands for the consolidated 0/1/2 exit matrix.
See Advanced Topics for more on sub-commands, custom host types, error handling, and error footers. Every help screen (global and per-command) lists -V, --version under GLOBAL OPTIONS:; usage-error footers hint at both --help and --version, while Fault/NoImplementation keep the single-sentence --help-only footer.
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
โโโโโโโโโโโโโโโ
RunAsync pipeline stages: hierarchy build โ CompletionGateway (completion > help > parse > version) โ help โ parse โ version check โ execute.
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 | Versions 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. |
-
net10.0
- AbsolutePathHelpers (>= 0.3.146)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Hosting (>= 10.0.10)
-
net6.0
- AbsolutePathHelpers (>= 0.3.146)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Hosting (>= 10.0.10)
-
net7.0
- AbsolutePathHelpers (>= 0.3.146)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Hosting (>= 10.0.10)
-
net8.0
- AbsolutePathHelpers (>= 0.3.146)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Hosting (>= 10.0.10)
-
net9.0
- AbsolutePathHelpers (>= 0.3.146)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Hosting (>= 10.0.10)
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.143 | 0 | 9/27/2026 |
| 4.1.142 | 33 | 9/23/2026 |
| 4.1.141 | 41 | 9/17/2026 |
| 4.1.140 | 38 | 9/16/2026 |
| 4.1.139 | 36 | 9/16/2026 |
| 4.1.138 | 38 | 9/15/2026 |
| 4.1.137 | 35 | 9/15/2026 |
| 4.1.136 | 40 | 9/14/2026 |
| 4.1.135 | 47 | 9/10/2026 |
| 4.1.134 | 321 | 9/9/2026 |
| 4.1.133 | 39 | 9/9/2026 |
| 4.1.132 | 45 | 9/9/2026 |
| 4.1.131 | 94 | 9/7/2026 |
| 4.1.130 | 59 | 9/4/2026 |
| 4.1.129 | 86 | 8/17/2026 |
| 4.1.128 | 45 | 8/17/2026 |
| 4.1.127 | 78 | 8/14/2026 |
| 4.1.126 | 49 | 8/13/2026 |
| 4.1.125 | 49 | 8/13/2026 |
| 4.1.124 | 67 | 8/12/2026 |
## New Version
* Bump `application_builder_helpers` from `4.1.142` to `4.1.143`. See [changelog](https://github.com/Kiryuumaru/ApplicationBuilderHelpers/compare/application_builder_helpers/4.1.142...application_builder_helpers/4.1.143)
## What's Changed
* fix(cli): use true Damerau-Levenshtein for did-you-mean (Fixes #555) by @Kiryuumaru in https://github.com/Kiryuumaru/ApplicationBuilderHelpers/pull/568
* fix(cli): help beats version on abstract and root commands (Fixes #554) by @Kiryuumaru in https://github.com/Kiryuumaru/ApplicationBuilderHelpers/pull/570
* fix(cli): bare collection MissingRequired (Fixes #556) by @Kiryuumaru in https://github.com/Kiryuumaru/ApplicationBuilderHelpers/pull/569
* fix(cli): path-before-help on named abstract parent (Fixes #558) by @Kiryuumaru in https://github.com/Kiryuumaru/ApplicationBuilderHelpers/pull/571
* fix(cli): route abstract near-miss to UnknownCommand kind by @Kiryuumaru in https://github.com/Kiryuumaru/ApplicationBuilderHelpers/pull/573
* fix(cli): concrete-root leading help-first renders global help (Fixes #559) by @Kiryuumaru in https://github.com/Kiryuumaru/ApplicationBuilderHelpers/pull/572
* cli: fail duplicate short names at build and runtime by @Kiryuumaru in https://github.com/Kiryuumaru/ApplicationBuilderHelpers/pull/574
* fix(cli): bind root positional arguments to root command options by @Kiryuumaru in https://github.com/Kiryuumaru/ApplicationBuilderHelpers/pull/575
* fix(cli): hide non-bindable inherited options from incompatible leaves (Fixes #561) by @Kiryuumaru in https://github.com/Kiryuumaru/ApplicationBuilderHelpers/pull/576
* fix(cli): list promoted globals on named-parent help by @Kiryuumaru in https://github.com/Kiryuumaru/ApplicationBuilderHelpers/pull/579
* fix(cli): show parent inherited Default line with unanimous gate by @Kiryuumaru in https://github.com/Kiryuumaru/ApplicationBuilderHelpers/pull/577
* fix(cli): abstract-root valued neighbor and satisfied-set repeat by @Kiryuumaru in https://github.com/Kiryuumaru/ApplicationBuilderHelpers/pull/578
* fix(cli): stop deploy shadowing from discarding inherited env by @Kiryuumaru in https://github.com/Kiryuumaru/ApplicationBuilderHelpers/pull/580
* fix(cli): bare trailing --shell on completions install/uninstall reports missing value by @Kiryuumaru in https://github.com/Kiryuumaru/ApplicationBuilderHelpers/pull/581
* fix(cli): redact secret remainder in short-cluster unknown-char errors by @Kiryuumaru in https://github.com/Kiryuumaru/ApplicationBuilderHelpers/pull/583
* fix(cli): early-return on malformed completion position by @Kiryuumaru in https://github.com/Kiryuumaru/ApplicationBuilderHelpers/pull/582
* cli: report only failing short-cluster char via SecretRedaction by @Kiryuumaru in https://github.com/Kiryuumaru/ApplicationBuilderHelpers/pull/584
**Full Changelog**: https://github.com/Kiryuumaru/ApplicationBuilderHelpers/compare/build.20260923094141.73156fb...build.20260927052237.9a33c35