Environment Naming and Appsettings
Learn how an environment's name sets its DOTNET_ENVIRONMENT value, and how to avoid issues when you name an environment Development.
Umbraco Cloud sets each environment's DOTNET_ENVIRONMENT value based on its name. The value decides which appsettings.{Name}.json file the environment loads. Naming an environment Development has side effects worth knowing before you create or rename one.
How the Environment Name Affects Configuration
ASP.NET Core loads appsettings.json first, then layers appsettings.{DOTNET_ENVIRONMENT}.json on top of it. The values in the second file win wherever the two overlap.
Umbraco Cloud sets the environment variable DOTNET_ENVIRONMENT to the environment's alias. The alias is a lowercase version of the environment name with spaces replaced by dashes. Live is the exception and always uses Production, even after a rename. You can view or override the value under Project Settings > Advanced.
Naming an environment QA, for example, applies appsettings.QA.json if that file exists in your project.
Why the Name Development Is Different
.NET and Umbraco project templates use Development for local development, set in launchSettings.json. The name also switches on development behavior, because env.IsDevelopment() returns true.
On older projects, Umbraco Cloud named the left-most mainline environment Development by default. Your project can use the name even if nobody on your team chose it.
When you name a Cloud environment Development, that environment takes over appsettings.Development.json, the same file your team uses for local development. The environment then runs in development mode.
The resulting issues tend to show up later, and they can look unrelated to the cause:
Local connection strings or Umbraco Deploy settings apply in the cloud, or the other way around.
Local development breaks after someone edits
appsettings.Development.jsonfor the cloud environment.Models Builder generates models on the cloud environment, even though you configured model generation for local use only.
File Name Casing
The appsettings file name must match DOTNET_ENVIRONMENT exactly, including casing. Umbraco Cloud sets this to the environment's lowercase alias. For example, an environment named UAT uses appsettings.uat.json. Live always uses appsettings.Production.json.
To confirm or override the value, go to Project Settings > Advanced.
Two Ways to Keep the Name Development
There is nothing wrong with the name Development itself. Some teams develop on the hosted environment and share settings with local development on purpose. Otherwise, decide who owns the name: your local machines or the cloud environment.
Option B is the smaller change, but you need to set the custom value again after every rename. Option A suits teams that want the portal name to match the configuration file name.
Option A: Move Local Development to Its Own Name
Keep the cloud environment named Development, and give local development a new name, for example Local. The cloud environment keeps running in development mode, so consider enabling Public Access on it.
Add an
appsettings.Local.jsonfile to your project, and move your local-only settings into it, such as connection strings, Umbraco Deploy local settings, and logging verbosity.
From Umbraco 17.7.0 and 18.2.0, the installer writes the connection string to appsettings.Local.json when you run the site as Local.
Add the file to
.gitignoreif it contains secrets.Update
launchSettings.jsonso your run profiles use the new name. .NET project templates set the name withASPNETCORE_ENVIRONMENT, as shown below.
Update any code that checks
env.IsDevelopment()to also checkenv.IsEnvironment("Local").Localisn'tDevelopment, soenv.IsDevelopment()returnsfalseon your machine.
Option B: Override the Variable on the Cloud Environment
Keep local development on Development, as the templates expect. Give the cloud environment a different configuration name, even though the portal still displays it as Development.
Go to Configuration > Advanced > Runtime Settings in the Cloud Portal, and select the environment.

Edit
DOTNET_ENVIRONMENTto a value such asCloudDev. Changing the value restarts the site.Add a matching
appsettings.CloudDev.jsonfile to your project with the settings that environment should use.
Naming Checklist
Check the following before you create or rename an environment:
Supported Umbraco Versions
This article applies to Umbraco 9 and later. Umbraco 7 and 8 projects run on .NET Framework instead of ASP.NET Core, so this guidance doesn't apply to them.
Last updated
Was this helpful?