dotnet / dotnet/aspnetcore

Allow WebApplication.CreateEmptyBuilder to have host configuration provided using ConfigurationManager

Open
#51,033 1 comment 0 reactions 0 assignees View on GitHub
area-hosting enhancement
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 7h
Merged PRs (30d)
275

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Is your feature request related to a problem? Please describe the problem.

A am trying to use `WebApplication.CreateEmptyBuilder` but my host configuration is loaded from multiple sources (files), but there is no way to provide host configuration to `WebApplication`, even though the inner `HostApplicationBuilder` accepts a `ConfigurationManager` through its options.
Current design forces me to copy the contents of the `WebApplicationBuilder` class into my project, just to be able to forward my 'external' configuration.

### Describe the solution you'd like

Add `ConfigurationManager? Configuration` property to the `WebApplicationOptions` that can be used to seed configuration by users.

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by tracing WebApplication.CreateEmptyBuilder and WebApplicationOptions into the inner HostApplicationBuilder, noting how ConfigurationManager is currently accepted there. Check how WebApplicationBuilder forwards its options and determine where the new configuration value should be seeded. Done means external host configuration can be supplied without copying WebApplicationBuilder, while preserving existing behavior when it is absent.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.