❔ App.config: "special one" for testing/debugging
Hello,
I'm making a small console application that needs some configuration (an API key, and a list of "filters"). I thought of saving that kind of configuration in an
App.config
file. Question is: how can I just have a "template" file for VCS storage, and have a "local" one filled with my secrets for testing/debugging?10 Replies
check this out:
https://learn.microsoft.com/en-us/aspnet/core/fundamentals/environments?view=aspnetcore-7.0
Use multiple environments in ASP.NET Core
Learn how to control app behavior across multiple environments in ASP.NET Core apps.
App.Debug.config
I'm not using ASP.NET, but thanks.
Care to develop a bit?
Oh yeah, sorry. What do you have so far? Have you implemented any Configuration files yet?
Ah, I see. This is sort of the .net framework way of doing thing, using ConfigurationManager. This is no longer the standard way of doing things.
Modern way of doing it would be to use appsettings.json. This could be implemented in a console app like:
and to do something that was environment specific,
Interesting, thanks
App.config was the first thing I found in the docs, so I went for that
I need to improve that anyway
I started using C# yesterday
(and I already have this working, this language is so productive!)
Thanks
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.