dotnet / dotnet/command-line-api

Method-first wiki example does not build

Open
#1,065 0 comments 0 reactions 0 assignees View on GitHub
Area-Documentation
Dominant language
C#
Stars
3.7k
Forks
428
PR merge metrics
No merged PRs in 30d

Description

The example given here: https://github.com/dotnet/command-line-api/wiki/How-To#method-first does not build
```cs
static void Main()
{
var rootCommand = new RootCommand();

MethodInfo method = typeof(Program).GetMethod(nameof(DoSomething));

rootCommand.ConfigureFromMethod(method);

rootCommand.InvokeAsync(args).Wait();
}
```
More precisely:
```cs
static void Main()
```
- missing `string[] args`

```cs
rootCommand.ConfigureFromMethod(method);
```
- Gives error: `'RootCommand' does not contain a definition for 'ConfigureFromMethod' and no accessible extension method 'ConfigureFromMethod' accepting a first argument of type 'RootCommand' could be found (are you missing a using directive or an assembly reference?)`
even with `using System.CommandLine.DragonFruit;`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.