[SOLVED] How can I list all of the configuration sources or properties in ASP.NET Core?


I want to ensure that a particular configuration property is being read from a configuration source. I was going to print out all of the configuration sources (or print out all of the configuration properties), but I can’t seem to figure out how to do that.

Can this be done?


You can get a list of all the keys discovered by all configuration sources by doing:

var keys = builder.Build().AsEnumerable().ToList();

I haven’t found a way to build each configuration source separately so you could see the sources individually.

In debug mode, you can see the private members and peek into each configuration source:

Debug configuration providers

Answered By – Nate Barbettini

Answer Checked By – Katrina (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *