I am starting asp.net core 2.1 coming from .NET and wondering how do I make multiple AppSetting.json files?
Before we had the webconfig that you could have webconfig.debug, webconfig.prod and etc.
What is the core equivalent to that?
I am starting asp.net core 2.1 coming from .NET and wondering how do I make multiple AppSetting.json files?
Before we had the webconfig that you could have webconfig.debug, webconfig.prod and etc.
What is the core equivalent to that?
By default ASP.NET Core will attempt to load an additional appsettings.<EnvironmentName>.json
file. Using the default environment names available, this allows you to create the following files:
appsettings.json
- loaded regardless of the environment nameappsettings.Development.json
- loaded only when the environment name is Development
appsettings.Staging.json
- loaded only when the environment name is Staging
appsettings.Production.json
- loaded only when the environment name is Production
The name of the environment is usually controlled via the ASPNETCORE_ENVIRONMENT
environment variable or via launchSettings.json
when developing (checkout the docs).
Take a look at the documentation for configuration for more info regarding this topic.