I'd like to read a part of the appSettings
of my console application from an external configuration file named, say, secrets.config
, while the rest of it I would like to read from the app.config
.
Presently, I have this set up but it seems like it isn't reading from secrets.config
and it isn't even telling me about the read 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"];
// secret turns out to be null