I would like to read the appSettings part of my console application from an external configuration file with the name, say, secrets.config , and I would like to read the rest from it from app.config .
I am currently set up, but it seems that it is not reading from secrets.config , and it does not even tell me about reading failure.
In my app.config
<appSettings file = "secrets.config"> <add key = "Foo" value = "Bar" /> </appSettings>
In secrets.config, which is in the same folder as app.config
<appSettings> <add key = "Secret" value = "Tiger" /> </appSettings>
In my code
var secret = ConfigurationManager.AppSettings["Secret"];
source share