Albatross.CommandLine.Defaults 9.0.0-rc.266

Prefix Reserved
This is a prerelease version of Albatross.CommandLine.Defaults.
dotnet add package Albatross.CommandLine.Defaults --version 9.0.0-rc.266
                    
NuGet\Install-Package Albatross.CommandLine.Defaults -Version 9.0.0-rc.266
                    
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="Albatross.CommandLine.Defaults" Version="9.0.0-rc.266" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Albatross.CommandLine.Defaults" Version="9.0.0-rc.266" />
                    
Directory.Packages.props
<PackageReference Include="Albatross.CommandLine.Defaults" />
                    
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 Albatross.CommandLine.Defaults --version 9.0.0-rc.266
                    
#r "nuget: Albatross.CommandLine.Defaults, 9.0.0-rc.266"
                    
#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 Albatross.CommandLine.Defaults@9.0.0-rc.266
                    
#: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=Albatross.CommandLine.Defaults&version=9.0.0-rc.266&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Albatross.CommandLine.Defaults&version=9.0.0-rc.266&prerelease
                    
Install as a Cake Tool

Albatross.CommandLine.Defaults

Adds opinionated, ready-to-use configuration and logging to an Albatross.CommandLine application through a single .WithDefaults() call. Logging is written to a file (never the console), so a command's standard output and standard error stay clean for its own output — a contract that scripts, pipes, and tooling can rely on. This package is optional; if you need a different logging framework or dependency versions, wire those up yourself against the core library.

Key Features

  • File-based logging by default - Serilog writes to a daily-rolling file under IApplicationPath.LogRoot; no console sink is attached, so stdout/stderr belong entirely to the command's output.
  • Config-driven verbosity - the log level, per-namespace overrides, extra sinks, and enrichers are read from a Serilog section via ReadFrom.Configuration, so verbosity is editable at deploy time without recompiling.
  • Sensible zero-config baseline - with no configuration at all, logging still works: Information level, FromLogContext + ThreadId enrichment, and the file sink are set in code; a Serilog section only layers on top.
  • JSON configuration - loads appsettings.json (plus appsettings.{DOTNET_ENVIRONMENT}.json) and environment variables, and registers ProgramSetting, EnvironmentSetting, and IHostEnvironment.
  • Composable - use .WithDefaults() for both, or .WithConfig() / .WithSerilog() individually.

Quick Start

Install alongside Albatross.CommandLine:

<PackageReference Include="Albatross.CommandLine.Defaults" Version="..." />

WithSerilog() writes to IApplicationPath.LogRoot, so register an IApplicationPath and pass its ConfigRoot to WithDefaults() (that is where appsettings.json is read from):

using Albatross.CommandLine;
using Albatross.CommandLine.Defaults;
using Albatross.Config;
using Microsoft.Extensions.DependencyInjection;
using MyApp.AutoGenerated;   // generated RegisterCommands()/AddCommands() live in <RootNamespace>.AutoGenerated

static async Task<int> Main(string[] args) {
    var appPath = new ApplicationPath(false, ["myapp"], "myapp", null, args);
    appPath.Init();   // creates ConfigRoot / LogRoot / DataRoot

    await using var host = new CommandHost("My CLI App")
        .RegisterServices((result, services) => {
            services.AddSingleton<IApplicationPath>(appPath);
            services.RegisterCommands();
        })
        .AddCommands()
        .Parse(args)
        .WithDefaults(appPath.ConfigRoot)   // config + file logging
        .Build();
    return await host.InvokeAsync();
}

To change verbosity, drop a Serilog section into appsettings.json (in ConfigRoot) — no rebuild required:

{
  "Serilog": {
    "MinimumLevel": {
      "Default": "Debug",
      "Override": { "Microsoft": "Warning", "System": "Warning" }
    }
  }
}

Dependencies

  • Albatross.Config (8.0.0-rc.51): application paths (IApplicationPath), configuration, and environment handling.
  • Serilog (4.3.0), Serilog.Extensions.Hosting (8.0.0), Serilog.Settings.Configuration (8.0.4), Serilog.Sinks.File (6.0.0), Serilog.Enrichers.Thread (4.0.0): file logging configured directly against Serilog.
  • Microsoft.Extensions.Hosting (8.0.1), Microsoft.Extensions.DependencyInjection (8.0.1): host builder and service container.

Prerequisites

  • .NET 8 (net8.0) or newer.
  • Registering an IApplicationPath before the host is built is optional — it controls where logs are written. If none is registered, WithSerilog() falls back to a DefaultApplicationPath that logs to a log folder under the application base directory.

Documentation

Complete Documentation

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
9.0.0-rc.266 42 7/11/2026
9.0.0-rc.261 44 7/10/2026
8.0.14 53 5/30/2026
8.0.12 51 5/8/2026
8.0.11 44 5/1/2026
8.0.8 77 2/23/2026
8.0.7 131 1/26/2026
8.0.6 74 1/23/2026
8.0.5 69 1/22/2026
8.0.4 70 1/21/2026
8.0.3 76 1/16/2026
8.0.2 77 1/11/2026
8.0.1 234 1/9/2026
Loading failed