Description
We have a dotnet 8.0 console application that is supposed to read an appsettings.{Environment.GetEnvironmentVariable("DOTNET_ENVIRONMENT")}.json file based on the value entered for the DOTNET_ENVIRONMENT environment variable. Unfortunately Environment.GetEnvironmentVariable("DOTNET_ENVIRONMENT") always returns null.
Reproduction Steps
Issue the following command:
dotnet run -c Release -e DOTNET_ENVIRONMENT=Docker
Expected behavior
Environment.GetEnvironmentVariable("DOTNET_ENVIRONMENT") should return the value Docker per the reproduction step to be able to utilize appsettings.Docker.json file.
Actual behavior
Environment.GetEnvironmentVariable("DOTNET_ENVIRONMENT") returns null or empty.
Regression?
No response
Known Workarounds
No response
Configuration
.NET SDK:
Version: 8.0.203
Commit: 5e1ceea679
Workload version: 8.0.200-manifests.8cf8de6d
Runtime Environment:
OS Name: Windows
OS Version: 10.0.22631
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\8.0.203\
Other information
No response
Description
We have a dotnet 8.0 console application that is supposed to read an
appsettings.{Environment.GetEnvironmentVariable("DOTNET_ENVIRONMENT")}.jsonfile based on the value entered for theDOTNET_ENVIRONMENTenvironment variable. UnfortunatelyEnvironment.GetEnvironmentVariable("DOTNET_ENVIRONMENT")always returns null.Reproduction Steps
Issue the following command:
Expected behavior
Environment.GetEnvironmentVariable("DOTNET_ENVIRONMENT")should return the valueDockerper the reproduction step to be able to utilizeappsettings.Docker.jsonfile.Actual behavior
Environment.GetEnvironmentVariable("DOTNET_ENVIRONMENT")returns null or empty.Regression?
No response
Known Workarounds
No response
Configuration
.NET SDK:
Version: 8.0.203
Commit: 5e1ceea679
Workload version: 8.0.200-manifests.8cf8de6d
Runtime Environment:
OS Name: Windows
OS Version: 10.0.22631
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\8.0.203\
Other information
No response