.NET Core environment variable returns null
问题 I have a .NET Core console application. I'm trying to retrieve the environment variable using the below code. var environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"); However, the variable "environment" always return null. I set the environment variable "ASPNETCORE_ENVIRONMENT" through Control Panel -> System Properties -> Environment Variables -> System Variables I also tried setting the environment variable using the command set ASPNETCORE_ENVIRONMENT=development ,