You can use Microsoft.Extensions.Configuration API with any .NET Core app, not only with ASP.NET Core app. Look into sample provided in the link, that shows how to read configs in the console app.
In most cases, the JSON source (read as .json
file) is the most suitable config source.
Note: don't be confused when someone says that config file should be
appsettings.json
. You can use any file name, that is suitable for you and file location may be different - there are no specific rules.
But, as the real world is complicated, there are a lot of different configuration providers:
and so on. You even could use/write a custom provider.
Actually, app.config
configuration file was an XML file. So you can read settings from it using XML configuration provider (source on github, nuget link). But keep in mind, it will be used only as a configuration source - any logic how your app behaves should be implemented by you. Configuration Provider will not change 'settings' and set policies for your apps, but only read data from the file.