❔ How do I use the appsetting.development?

Hey i got 2 files, 1 for prod 1 for development, i want to load the dev one when im working on my machine, whats the best way to do it?
6 Replies
Anton
Anton2y ago
"load" as in?
antimatter8189
antimatter8189OP2y ago
as in use the connection string etc different connection string different variables
Relevant
Relevant2y ago
Generally this is done with environment variables. Setting ASPNETCORE_ENVIRONMENT to "development", but there are situations where that wouldn't work
antimatter8189
antimatter8189OP2y ago
Yeah i've done it, but how does it know to load the correct file? and another question is, why doesnt my gui show the different enviroment options? i need to activate it somehow?
Pobiega
Pobiega2y ago
If you are using Host.CreateDefaultHostBuilder() it comes with that behaviour already. If not, you can do it yourself in your configuration builder by loading the base file and optionally loading the environment specific one
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.

Did you find this page helpful?