The Startup class contains
public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);
Console.WriteLine($"{env.EnvironmentName.ToString()}");
if (env.IsDevelopment())
{
// For more details on using the user secret store see
// https://go.microsoft.com/fwlink/?LinkID=532709
builder.AddUserSecrets();
}
builder.AddEnvironmentVariables();
Configuration = builder.Build();
}
but env.EnvironmentName.ToString() returns "Production".
I already setup my ASPNETCORE_ENVIRONMENT to "Development" in launchSettings.json
ASPNETCORE_ENVIRONMENT
in project settings / launchSettings.json is only applied when starting from Visual Studio via F5 / Ctrl + F5. Starting it via dotnet or by any other means do not apply it. launchSattings.json is a pure VIsual Studio Mechanic