Skip to content

Add CommandLineState to the HostBuilder.Properties dictionary #367

@danielmeza

Description

@danielmeza

Provide access to the CommandLineState throw the Properties on a HostBuilder will allow us to access it in scenarios where there are not DI yet, like in the ConfigureService or ConfigureAppConfiguration methods.

Solution:
Add (

var state = new CommandLineState(args);
) tot he Properties at HostBuilder like this.

hostBuilder.Properties[typeof(CommandLineState)] = state

We can also create extension methods to get the CommandLineState on the IHostBuild and on HostBuilderContext .

Metadata

Metadata

Assignees

Labels

enhancementhelp wantedWe would be willing to take a well-written PR to help fix this.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions