-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Description
Description
Starting with .NET 9, the priority of how app runtime configuration (https://learn.microsoft.com/dotnet/core/runtime-config/) is resolved has changed. If both an environment variable and a corresponding setting in the application's runtimeconfig.json (or project file) are provided, the environment variable takes precedence over the configuration file.
Version
.NET 9
Previous behavior
When both an environment variable and the corresponding setting in the application's runtimeconfig.json are set, the runtimeconfig.json took precedence.
New behavior
When both an environment variable and the corresponding setting in the application's runtimeconfig.json are set, the environment variable takes precedence.
Type of breaking change
- Binary incompatible: Existing binaries might encounter a breaking change in behavior, such as failure to load or execute, and if so, require recompilation.
- Source incompatible: When recompiled using the new SDK or component or to target the new runtime, existing source code might require source changes to compile successfully.
- Behavioral change: Existing binaries might behave differently at run time.
Reason for change
The new behaviour is more consistent with how configuration tends to work in .NET and elsewhere, with environment variables taking precedence.
Recommended action
If running in an environment with the environment variable set to a configuration value different than what is desired, either unset the environment variable or set it to the desired configuration value.
Feature area
Deployment
Affected APIs
No response
Metadata
Metadata
Labels
Type
Projects
Status