ASP.NET Core simply takes value of ASPNETCORE_ENVIRONMENT system variable for running applications on server. On Windows, you can either add/update this variable using Advanced System Settings > Advanced > Environment Variables panel. OR simply you can use SETX command from command window (terminal):


SETX command writes value of the variable to user environment variables and it is permanent.

However, if you want to change value of the environment variable for current run only, you can use SET command to change value of the variable temporarily. This value doesn’t change until you close that command window:


I hope you found this tip useful, Enjoy!