Portico 0.2.0

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

Portico

The command surface for .NET backend services. Contract-first CLI routing where your examples are executable tests — one CliContractValidator<T> test runs every [CliCommandExample] through the real pipeline, and Roslyn analyzers check the rest at compile time. Zero dependencies.

dotnet add package Portico
using Portico;

public interface IAdminTool
{
    [CliRoute("db migrate")]
    [CliCommandExample("db migrate --connection-string \"Host=db\"")]
    int Migrate([CliOption("--connection-string|-c", Sensitive = true)] string connectionString);
}

One CliContractValidator<T> test runs every [CliCommandExample] through the real pipeline, and a stale one fails the test suite and CI.

Or start from a template — one for a new project, one for a service you already have:

dotnet new install Portico.Templates

dotnet new portico-cli -n MyCli && cd MyCli && dotnet test   # a whole new CLI
dotnet new portico-command -n Migrate                        # one command, into this project

Four operational capabilities

  • Secrets stay out of your logs. [CliOption("--token", Sensitive = true)] — the value is withheld from every message the framework composes. All six others interpolate what the user typed into parse errors, and in a container stderr is the log stream.
  • Durations the way an operator types them. --timeout "30 seconds", 90s, 1h30m, PT30S. A bare --timeout 30 is refused rather than silently meaning thirty days, which is what .NET's own TimeSpan parser does with it.
  • 17 collection shapes, immutable ones included — ImmutableArray<T>, ImmutableHashSet<T> and the rest bind directly. So do string-keyed maps: --shard eu=3 (or '--shard[eu]' 3).
  • Named POSIX exit codes. CliExitException.UsageErrorExitCode, CancelledExitCode, TerminatedExitCode — so a pipeline reading $? can tell misconfigured from failed.

The whole surface, every entry backed by a test.

For a dated, source-checked comparison with other .NET CLI frameworks, including prior art and the cases where another framework is the better choice, see The alternatives, honestly.

Package What it adds
Portico.DependencyInjection Resolve contracts from an IServiceProvider, one scope per command
Portico.Hosting Generic Host integration — reuse your service's host, DI, config and logging

Full documentation: github.com/vvka-141/portico · Issues and feedback: github.com/vvka-141/portico/issues

Portico is 0.x. The API is still being shaped by what breaks, so a rough edge is worth an issue rather than a workaround.

Product Compatible and additional computed target framework versions.
.NET 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 was computed.  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.
  • net10.0

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Portico:

Package Downloads
Portico.DependencyInjection

Microsoft.Extensions.DependencyInjection integration for Portico, the contract-first CLI framework for .NET. Resolve command contracts and middleware from an IServiceProvider, with one IServiceScope per dispatched command. Command services stay lazy, and scoped resources are disposed after success, failure or cancellation. The core Portico package stays dependency-free; this is the opt-in.

Portico.Hosting

Microsoft.Extensions.Hosting integration for Portico, the contract-first CLI framework for .NET. Register command contracts with HostApplicationBuilder and reuse the application's configuration, logging and dependency injection rather than rebuilding them. Graceful shutdown defers to IHostApplicationLifetime, and the command's exit code reaches Main.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.0 165 7/31/2026
0.1.1 167 7/29/2026
0.1.0 100 7/28/2026