Skip to content

UseDefaultHostingConfiguration has been removed #174

@BrennanConroy

Description

@BrennanConroy

.UseDefaultHostingConfiguration(args) has been removed.

To have equivalent behavior from before you can add:

var config = new ConfigurationBuilder() .AddJsonFile("hosting.json", optional: true) .AddEnvironmentVariables(prefix: "ASPNETCORE_") .AddCommandLine(args) .Build(); var host = new WebHostBuilder() .XYZ() .UseConfiguration(config) .ZYX() .Build(); 

And also ensure the application's project.json file has references to these NuGet packages:

  • Microsoft.Extensions.Configuration.ComandLine
  • Microsoft.Extensions.Configuration.EnvironmentVariables
  • Microsoft.Extensions.Configuration.Json

In addition ASPNETCORE_ENVIRONMENT is included as a fallback if you don't add a setting for "environment" yourself.

Most apps don't need all these settings though.

Issues causing the removal of UseDefaultHostingConfiguration are aspnet/Hosting#700 and aspnet/Hosting#727

Please use aspnet/Hosting#737 for discussion

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions