Minimal API for CommandLine tool by ConsoleAppFramework v4

Yoshifumi Kawai
2 min readDec 29, 2021

Minimal API in ASP .NET Core 6 is a one of great feature of .NET 6. This API, which takes full advantage of the power of C# 10.0, has made it very easy to create WebApplications while maintaining a high level of extensibility.

However, parsing with System.CommandLine still requires complex boilerplate.

I've just released Cysharp/ConsoleAppFramework v4. Inspired by the Minimal API, it allows you to create a command line tool in one line.

By taking advantage of C# 10.0 features, it can be written in a one line, without any additions, right after downloading it from NuGet.

If this is a System.CommandLine, it will require a lot of new.

If you create a lot of commands, System.CommandLine will need a lot more code, but the ConsoleAppFramework will keep it simple.

ConsoleAppFramework can create easily many command applications. Also enable to use GenericHost configuration is the best way to share configuration/workflow when creating batch application for other .NET web app.

You will quickly realize how small the code is, how extensible it is, and how share it is with ASP.NET Core. Please try it.

--

--

Yoshifumi Kawai

a.k.a. neuecc. Creator of UniRx, UniTask, MessagePack for C#, MagicOnion etc. Microsoft MVP for C#. CEO/CTO of Cysharp Inc. Live and work in Tokyo, Japan.