-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Add guidance for selecting IHostApplicationBuilder vs IHostBuilder #51460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…ion criteria Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR addresses issue #46082 by adding a new "Host builder options" section to the Generic Host documentation. The section explains the differences between IHostApplicationBuilder and IHostBuilder configuration patterns, providing selection criteria that were previously missing.
Changes:
- Added a new "Host builder options" section explaining the two approaches for configuring a Generic Host
- Updated the ms.date field to reflect the documentation update
The generic host documentation presents two configuration patterns in tabbed examples without explaining the differences or selection criteria, leaving readers to guess which approach to use.
Changes
Added "Host builder options" section before "Set up a host" explaining:
IHostApplicationBuilder(.NET 6+): Linear, property-based configuration viabuilder.Services,builder.ConfigurationIHostBuilder(legacy): Callback-based configuration viaConfigureServices,ConfigureAppConfigurationSelection criteria: Use
IHostApplicationBuilderfor new projects (current default). UseIHostBuilderfor existing codebases or third-party library compatibility.The new section provides context immediately before readers encounter the first tabbed code examples, clarifying that both approaches have identical functionality and defaults despite different configuration styles.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.
Internal previews