Closed
Description
The WebApplicationBuilder has top level properties to remove some of the callback noise and we should push developers towards using those properties in their code since they are the moral equivalent to the Configure* callbacks:
var builder = WebApplication.CreateBuilder(args);
builder.Host.ConfigureAppConfiguration(builder =>
{
builder.AddJsonFile("foo.json", optional: true);
});
// OR
builder.Host.ConfigureHostConfiguration(builder =>
{
builder.AddJsonFile("foo.json", optional: true);
});
// OR
builder.WebHost.ConfigureAppConfiguration(builder =>
{
builder.AddJsonFile("foo.json", optional: true);
});
Should be rewritten to:
var builder = WebApplication.CreateBuilder(args);
builder.Configuration.AddJsonFile("foo.json", optional: true);