0

I have a .Net core console application and when I run it the following method is hit in Startup.cs class

public void Configure(IApplicationBuilder app, IHostingEnvironment env)

If I check the contents of env, the EnvironmentName property is set to Production. I am wondering, where in the code path does it identify whether the environment is DEV, QA or Production?

user163824
  • 115
  • 5
  • Documentation: https://learn.microsoft.com/en-us/aspnet/core/fundamentals/environments?view=aspnetcore-3.1 – Nkosi Aug 12 '20 at 22:05
  • Take a look at this [post](https://stackoverflow.com/questions/46364293/automatically-set-appsettings-json-for-dev-and-release-environments-in-asp-net-c). This could be coming from the project properties or the appsettings.json file (if it exists). – insane_developer Aug 12 '20 at 23:49
  • @insane_developer - Actually, thats what I want to know. I have 4 appsettings.json files one for each environment. How does the application choose which one to look at? – user163824 Aug 13 '20 at 16:57

1 Answers1

0

Since you are not showing the relevant configuration code to work with multiple appsetting.json files, all I can do is point you to a resource that shows how to properly do it in a Console application. This is how I normally see it done in web applications.