Skip to content

Update CreateSlimBuilder for Microsoft.Extensions.Hosting.Host.CreateEmptyApplicationBuilder #46293

Closed
@eerhardt

Description

@eerhardt

Once dotnet/runtime#81280 is implemented, we should take advantage of this new API in CreateSlimBuilder:

_hostApplicationBuilder = new HostApplicationBuilder(new HostApplicationBuilderSettings
{
DisableDefaults = true,
Args = options.Args,
ApplicationName = options.ApplicationName,
EnvironmentName = options.EnvironmentName,
ContentRootPath = options.ContentRootPath,
Configuration = configuration,
});

This should cut about 1.3 MB of a NativeAOT published Windows x64 app. Prototyping this change on my machine results the Benchmark app:

Before
15.2 MB (16,007,168 bytes)

After
13.9 MB (14,593,024 bytes)

And 1.4MB on Linux x64:

Before
18.6 MB (19,601,424 bytes)

After
17.2 MB (18,132,768 bytes)

Metadata

Metadata

Assignees

Labels

old-area-web-frameworks-do-not-use*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions