The Core of .NET

VSTH07 Building Intuitive Command-line Interfaces in .NET


9:30am - 10:45am

Level: Intermediate

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 typo corrections. In this session, you will learn how to implement commands, with arguments and options, and leverage the built-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 be ready to go and build CLIs for your own .NET applications and tooling with minimal effort.

You will learn:

  • Use System.CommandLine to create CLI interfaces for .NET applications
  • Making discoverable and intuitive CLI using designs and patterns
  • Leverage CLIs in DevOps scenarios using pipelines for CI/CD