The following code works perfectly fine in NetCore 3.1 but doesn't work in .Net5
var webHostBuilder = WebHostBuilder(args);
var environment = webHostBuilder.GetSetting("environment");
The following code works perfectly fine in NetCore 3.1 but doesn't work in .Net5
var webHostBuilder = WebHostBuilder(args);
var environment = webHostBuilder.GetSetting("environment");
Use GetService< IHostEnvironment>