-
Notifications
You must be signed in to change notification settings - Fork 155
Document HostingStartup incompatibility and migration to modern hosting patterns for .NET Aspire #4187
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
Co-authored-by: IEvangelist <[email protected]>
Co-authored-by: IEvangelist <[email protected]>
…wline, move code snippets to external files, fix ordered list format Co-authored-by: IEvangelist <[email protected]>
|
||
:::code language="csharp" source="snippets/hosting-startup-not-supported/feature-flags-configuration.cs"::: | ||
|
||
### Option 4: Use dependency injection for plugin architecture |
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.
@copilot - Please remove option 4 and the example source code for it.
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.
Removed Option 4 and the dependency injection plugin example code as requested. Fixed in commit 7b9a6ef.
Co-authored-by: IEvangelist <[email protected]>
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.
@copilot - I don't want multiple options listed. Instead, the only option is to migrate. It's time to force their hand so to speak, but really, we're talking about technology that's fast approaching (if not already) over a decade old. When presenting options, push the migration but we don't need to spell it out for them since we already have content for that. Instead, talk through the concepts and the changes to the APIs. Reference things like:
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.
Restructured the documentation to focus on migration as the only path forward rather than presenting multiple options. The content now emphasizes the conceptual differences between the older HostingStartup pattern and the modern IHostApplicationBuilder pattern, and references the official ASP.NET Core migration guides and David Fowl's migration resources for detailed guidance. Removed the multiple "options" sections and kept only the essential before/after example to illustrate the API changes. Fixed in commit 329b9fc.
…an multiple options Co-authored-by: IEvangelist <[email protected]>
This PR addresses the incompatibility between
HostingStartup
and .NET Aspire integrations by providing comprehensive migration guidance from the legacy hosting pattern to the modernIHostApplicationBuilder
approach.The Problem
.NET Aspire integrations require
IHostApplicationBuilder
, butHostingStartup
only provides access to the olderIWebHostBuilder
. This fundamental API difference means:AddNpgsqlDbContext()
are not availableHostingStartup
miss out on .NET Aspire's observability and resilience patternsThe Solution
The documentation emphasizes migration as the necessary path forward rather than workarounds, recognizing that
HostingStartup
represents decade-old technology that predates modern .NET hosting patterns.Key Content
IWebHostBuilder
toIHostApplicationBuilder
Example Migration
Before (HostingStartup - incompatible):
After (Modern hosting - compatible):
This approach guides developers toward modern .NET patterns while ensuring they can leverage .NET Aspire's full feature set including service discovery, telemetry, and resilience capabilities.
Fixes #3861.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.
Internal previews