XO.Console.Cli.Extensions 5.0.9

dotnet add package XO.Console.Cli.Extensions --version 5.0.9
NuGet\Install-Package XO.Console.Cli.Extensions -Version 5.0.9
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="XO.Console.Cli.Extensions" Version="5.0.9" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add XO.Console.Cli.Extensions --version 5.0.9
#r "nuget: XO.Console.Cli.Extensions, 5.0.9"
#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.
// Install XO.Console.Cli.Extensions as a Cake Addin
#addin nuget:?package=XO.Console.Cli.Extensions&version=5.0.9

// Install XO.Console.Cli.Extensions as a Cake Tool
#tool nuget:?package=XO.Console.Cli.Extensions&version=5.0.9

XO.Console.Cli.Extensions

This library integrates XO.Console.Cli applications with the .NET runtime extensions, including dependency injection and the .NET Generic Host. By default, the integration:

  • Adds CommandAppBuilderOptions and ICommandApp to the service collection
  • Configures XO.Console.Cli to create instances of command and parameters types using IServiceProvider (which means you can use constructor injection for dependencies)
  • Sets the command-line application name to IHostEnvironment.ApplicationName
  • Wraps IHost startup and command execution to ensure the application reliably logs critical exceptions and responds to shutdown signals

Getting Started

1. Add a reference

> dotnet add package XO.Console.Cli.Extensions

If your project does not already reference Microsoft.Extensions.Hosting, add that, too.

> dotnet add package Microsoft.Extensions.Hosting

2. Set up and run the host

return await Host.CreateDefaultBuilder(args)
    .RunCommandAppAsync(args, static (context, builder) => {
        builder.AddCommand<GreetingCommand>("greet");
    });

Integration with the simpler IHostApplicationBuilder is also possible. First, add the command-line application to the service collection. Then, build the host. Finally, run the configured command-line application.

HostApplicationBuilder builder = Host.CreateApplicationBuilder(args);
builder.Services.AddCommandApp(static (context, builder) => {
    builder.AddCommand<GreetingCommand>("greet");
});

IHost host = builder.Build();
return await host.RunCommandAppAsync(args);
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 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on XO.Console.Cli.Extensions:

Package Downloads
XO.Console.Cli.Instrumentation

OpenTelemetry instrumentation for XO.Console.Cli

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
5.0.9 79 6/11/2024
4.0.5 110 11/29/2023
4.0.4 185 6/22/2023
3.0.7 435 8/29/2022
2.0.10 456 7/19/2022
2.0.9 390 6/15/2022
2.0.8 396 6/15/2022