79276636

Date: 2024-12-12 21:26:41
Score: 0.5
Natty:
Report link

Turns out I have to manually set the env variable passed in args, so in Program.cs:

Environment.SetEnvironmentVariable("DOTNET_ENVIRONMENT", args[1]);

and after that you read it elsewhere by:

Environment.GetEnvironmentVariable("DOTNET_ENVIRONMENT")

The args are passed like this: exename.exe --environment Production

Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: akr