dotnet / dotnet/command-line-api

Guidance on how to use Configuration and DI APIs

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

Description

Hi,
I'm sorry if issues aren't the proper place for this kind of posts but I couldn't find the discussion board.

I've recently created an console application that reuses services that are mainly designed to be hosted in a ASP.NET Core application and thus relying on APIs like Configuration, ServiceCollection/Provider and so on.

I was able to get something working (see [this gist](https://gist.github.com/Kralizek/b0b205221879dc6f39758c5c849c41cd#file-program-cs)) but I'm quite unhappy on how bloated the handler looks like.

I've tried to use the `System.CommandLine.Hosting` package and I've played around with the HostingPlayground sample. I got to [this gist](https://gist.github.com/Kralizek/b0b205221879dc6f39758c5c849c41cd#file-program2-cs) but I'm a bit at loss on how to push into the configuration system the values coming from arguments (e.g. AWS profile name and region). Same goes on how to access the Configuration when registering services.

Thanks.

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.