I created a simple webapi project with dotnet core.
I'm trying to set the running environment using the ASPNETCORE_ENVIRONMENT system variable.
C:\devel\apps\webapi>set ASPNETCORE_ENVIRONMENT=Production
C:\devel\apps\webapi>echo %ASPNETCORE_ENVIRONMENT%
Production
C:\devel\apps\webapi>dotnet run
Using launch settings from C:\devel\apps\webapi\Properties\launchSettings.json...
info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
User profile is available. Using 'C:\Users\SSCARANO\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.
Hosting environment: Development
Content root path: C:\devel\apps\webapi
Now listening on: https://localhost:5001
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.
I tried opening a different console, and also setting it logged in as administrator, but the app is always running on Development mode.
I saw this (https://mcmap.net/q/479715/-asp-net-core-hosting-environment-variable-ignored) related question, but I'm not using IIS