Support Host.CreateApplicationBuilder with an IServiceCollection extension
kmgallahan opened this issue · 2 comments
There is a new Host.CreateApplicationBuilder
method that appears to be preferred over Host.CreateDefaultBuilder
.
Per the .NET runtime team:
We moved away from the ceremony of a generic host in the default templates and to the scenario specific WebApplicationBuilder. The general idea was to move away from calbacks and move to linear code for configuring everything, this was part of .NET 6. In .NET 7, we added var builder = Host.CreateApplicationBuilder() as the backbone of WebApplication.CreateBuilder so we could have a smoother integration of the API styles (building the linear API on top of the callback API was error prone).
dotnet/runtime#81090 (comment)
Serilog handled this by adding a UseSerilog
extension method for IServiceCollection
and updating the IHostBuilder
extension implementation to use it:
serilog/serilog-extensions-hosting#70
Note
Host.CreateApplicationBuilder
is only available from .NET 7+
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 30 days.
MessagePipe provides the extensions to IServiceCollection and does not depend on IHostBuilder.
So the following is valid.
var builder = Host.CreateApplicationBuilder();
builder.Services.AddMessagePipe();
What exactly does "support" mean ?