Corner49.Infra.CLI 10.0.169

dotnet add package Corner49.Infra.CLI --version 10.0.169
                    
NuGet\Install-Package Corner49.Infra.CLI -Version 10.0.169
                    
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="Corner49.Infra.CLI" Version="10.0.169" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Corner49.Infra.CLI" Version="10.0.169" />
                    
Directory.Packages.props
<PackageReference Include="Corner49.Infra.CLI" />
                    
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 Corner49.Infra.CLI --version 10.0.169
                    
#r "nuget: Corner49.Infra.CLI, 10.0.169"
                    
#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 Corner49.Infra.CLI@10.0.169
                    
#: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=Corner49.Infra.CLI&version=10.0.169
                    
Install as a Cake Addin
#tool nuget:?package=Corner49.Infra.CLI&version=10.0.169
                    
Install as a Cake Tool

Corner49.Infra.CLI

Opinionated bootstrap for .NET console apps, workers and containerised jobs. Part of Corner49.Infra – a set of packages that provide opinionated tooling for infrastructure in .NET applications.

It gives a generic host the same configuration, logging and extension model that Corner49.Infra gives a web app, and adds two ways to decide what the process does: named jobs or System.CommandLine.

dotnet add package Corner49.Infra.CLI

Do not reference this package together with Corner49.Infra in the same project; both define Corner49.Infra.InfraBuilder.

Getting started

using Corner49.Infra;

var infra = InfraBuilder.Create("MyTool", args)
    .WithLogging(opt => opt.WriteToConsoleAsJson = false);

infra.AddJob<HelloWorldJob>("Hello", "Print hello world in the console");
infra.AddJob<ImportJob>("Import", "Import the nightly product feed");

await infra.BuildAndRun(args);
using Corner49.Infra.Jobs;

public class ImportJob : IJob {
    private readonly IProductRepo _repo;

    public ImportJob(IProductRepo repo) {
        _repo = repo;
    }

    public async Task Execute(string[]? args = null, CancellationToken cancellationToken = default) {
        // args[0] is the job name, the rest are your own arguments
    }
}

Run a job by passing its name as the first argument (not case sensitive):

MyTool import 2026-10-07

Running without arguments prints the registered jobs and their descriptions.

What BuildAndRun(args) does

After building the host and starting the registered extensions, it picks one of three modes:

Registered Behaviour
WithCommandLine(...) Parses args with your System.CommandLine root command and invokes it. Takes precedence over jobs.
One or more AddJob<T>(...) Runs the job named by args[0], then exits.
Neither Runs the host until shutdown (RunAsync), for hosted services and workers.

Builder API

Method Purpose
InfraBuilder.Create(name, args) Creates a HostApplicationBuilder and calls UseInfra on it.
builder.UseInfra(name, environment?) Same, for an existing IHostApplicationBuilder.
WithOptions<T>(section?) Binds a configuration section to T. The section name defaults to the type name without its Options or Configuration suffix.
WithLogging(options?) Activity tracking, optional JSON console output and category-prefix filtering (errors always pass the filter). A plain console logger is added when a debugger is attached or ConsoleLog=true is set.
AddJob<T>(name, description?) Registers an IJob as a keyed singleton under name.
WithCommandLine(cmd => ..., description) Configures a System.CommandLine RootCommand.
AddExtension(extension) Adds an InfraExtension; this is what AddDocumentDB, AddServiceBus and friends use.
Services, Configuration The underlying IServiceCollection and IConfigurationManager for your own registrations.

After the host is built, InfraBuilder.Instance.Services exposes the service provider for code that cannot use constructor injection.

Configuration

UseInfra loads, in this order:

  1. appsettings.json
  2. appsettings.{Environment}.json
  3. appsettings.{MachineName}.json
  4. Environment variables

All files are optional. If that configuration contains an AppConfig connection string, Azure App Configuration is added underneath it (unlabelled keys, then keys labelled with the environment name, then keys labelled with the machine name). Local settings always override App Configuration.

Using the Azure packages

infra.AddDocumentDB(db => db.AddRepo<IProductRepo, ProductRepo>());   // Corner49.Infra.AzureCosmosDB
infra.AddServiceBus(cfg => { });                                      // Corner49.Infra.AzureServiceBus
infra.AddBlobService("Documents");                                    // Corner49.Infra.AzureStorage

Repositories registered this way can be injected straight into your jobs.

Source: https://github.com/FrankVDL2471/Corner49.Infra

Product Compatible and additional computed target framework versions.
.NET 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
10.0.169 43 10/21/2026
10.0.168 47 10/21/2026
10.0.167 48 10/21/2026
10.0.166 59 10/20/2026
10.0.165 59 10/20/2026
10.0.164 55 10/20/2026
10.0.163 51 10/20/2026
10.0.162 51 10/20/2026
10.0.161 51 10/20/2026
10.0.159 55 10/20/2026
10.0.158 70 10/19/2026
10.0.157 59 10/19/2026
10.0.156 64 10/16/2026
10.0.154 84 10/14/2026
10.0.153 87 10/14/2026
10.0.151 106 10/8/2026
10.0.150 88 10/8/2026
10.0.149 83 10/8/2026
10.0.148 90 10/8/2026
10.0.147 91 10/8/2026
Loading failed