LoganBussell.CommandLineGenerator
0.2.0-preview.2026.2.22
This is a prerelease version of LoganBussell.CommandLineGenerator.
dotnet add package LoganBussell.CommandLineGenerator --version 0.2.0-preview.2026.2.22
NuGet\Install-Package LoganBussell.CommandLineGenerator -Version 0.2.0-preview.2026.2.22
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="LoganBussell.CommandLineGenerator" Version="0.2.0-preview.2026.2.22" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LoganBussell.CommandLineGenerator" Version="0.2.0-preview.2026.2.22" />
<PackageReference Include="LoganBussell.CommandLineGenerator" />
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 LoganBussell.CommandLineGenerator --version 0.2.0-preview.2026.2.22
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: LoganBussell.CommandLineGenerator, 0.2.0-preview.2026.2.22"
#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 LoganBussell.CommandLineGenerator@0.2.0-preview.2026.2.22
#: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=LoganBussell.CommandLineGenerator&version=0.2.0-preview.2026.2.22&prerelease
#tool nuget:?package=LoganBussell.CommandLineGenerator&version=0.2.0-preview.2026.2.22&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
CommandLineGenerator
A package that generates System.CommandLine boilerplate for you.
Features
- Generate CLI commands from simple C# classes with attributes
- Zero runtime reflection - everything is generated at compile time
- Native AOT compatible
- No runtime library dependency - all code is generated
Usage
- Add the package to your project:
<PackageReference Include="LoganBussell.CommandLineGenerator" Version="0.1.0" />
- Create a command class with the
[Command]attribute:
[Command("hello", Description = "Say hello")]
public class HelloCommand
{
[Argument(Description = "Name to greet")]
public required string Name { get; set; }
[Option("-c", "--count", Description = "Number of times to greet")]
public int Count { get; set; } = 1;
public Task<int> ExecuteAsync()
{
for (int i = 0; i < Count; i++)
{
Console.WriteLine($"Hello, {Name}!");
}
return Task.FromResult(0);
}
}
- Build your CLI app:
return await ConsoleApp.RunAsync(args);
How It Works
The source generator analyzes your command classes at compile time and generates:
[Command],[Argument], and[Option]attributesConsoleAppandConsoleAppBuilderclasses- Command factory methods that wire up System.CommandLine
All generated code is visible in your IDE and can be inspected at obj/Debug/net*/generated/CommandLineGenerator/.
License
MIT
There are no supported framework assets in this package.
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
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 |
|---|---|---|
| 0.2.0-preview.2026.2.22 | 93 | 2/22/2026 |
| 0.1.0-preview.2026.2.5 | 78 | 2/5/2026 |