Add Host.CreateEmptyApplicationBuilder (#81728)
authorEric Erhardt <eric.erhardt@microsoft.com>
Thu, 9 Feb 2023 18:59:14 +0000 (12:59 -0600)
committerGitHub <noreply@github.com>
Thu, 9 Feb 2023 18:59:14 +0000 (12:59 -0600)
commit89d35bae5388cc6c8ec4c0fb078ff7cf639e4d51
treef237071736483ac6ac17e7c0e48bccaece779120
parente8457e9bdf81b30f1c3487ecec7541f1c99b5bec
Add Host.CreateEmptyApplicationBuilder (#81728)

* Add Host.CreateEmptyApplicationBuilder

Introduce a way to create an "empty" HostApplicationBuilder that doesn't bring any optional/unnecessary dependencies into the app's closure. This has the same functional behavior as DisableDefaults=true while allowing for the unused code to be trimmed.

Also add CreateApplicationBuilder(HostApplicationBuilderSettings settings) overload to make the Host factory methods complete.

Fix #81280
src/libraries/Microsoft.Extensions.Hosting/ref/Microsoft.Extensions.Hosting.cs
src/libraries/Microsoft.Extensions.Hosting/src/Host.cs
src/libraries/Microsoft.Extensions.Hosting/src/HostApplicationBuilder.cs
src/libraries/Microsoft.Extensions.Hosting/src/HostingHostBuilderExtensions.cs
src/libraries/Microsoft.Extensions.Hosting/tests/UnitTests/HostApplicationBuilderTests.cs