How does EnvironmentName work?
.NET Core reads the name from an environment variable .
How can I indicate that my local machine is a development environment?
Set the Development environment variable.
How can I indicate that Azure is a production environment?
Set the environment variable Production .
As an additional point, is it possible to configure EnvironmentName to work with Debug and Release configurations within the solution?
You can create a launch profile that sets the environment name and uses this profile with Debug or Release settings. The startup profile affects EnvironmentName when launched from Visual Studio; You will need to use other means to install it when you launch the application in other environments.
The following figure shows how to run the application in the Release configuration and the MyDevProfile file, which sets EnvironmentName to Development .

source share