The Core of .NET

W17 Building Intuitive Command-line Interfaces in .NET

03/22/2023

2:30pm - 3:45pm

Level: Advanced

Alex Thissen

Architect, Lead Developer, and Mentor

The cross-platform story for .NET continues. More and more tooling uses a command-line interface to make it easy to execute complex tasks from a script or console. Microsoft has invested in this area for their own tooling, such as the dotnet CLI or project Tye. You can benefit from their efforts by using System.CommandLine to build your own CLI or parametrize your application startup with arguments and options.

The Microsoft .NET libraries hold a number of great packages to create intuitive CLIs, with commands that have features such as suggestions with tab-completion and typocorrections. In this session you will learn how to implement commands, with arguments and options, and leverage the build-in functionality such as binding, validation, middle-ware, command-hierarchies, parsing and much more. We are going to cover practical examples and use-cases, plus tips and tricks for efficient development and debugging. After this session you can are ready to go and build CLIs for your own .NET applications and tooling with minimal effort.

You will learn:

  • How to use System.CommandLine to create CLI interfaces for .NET applications
  • About making discoverable and intuitive CLI using designs and patterns
  • How to leverage CLIs in DevOps scenarios using pipelines for CI/CD