Larsenal
Larsenal

Reputation: 51146

Which file is System.Configuration.ConfigurationManager.AppSettings using?

I want to know which *.config file the ConfigurationManager is using. How can I figure that out?

For instance, you could be changing working directories and execute libraries from various paths. I'd love to have a way to display something like "Reading AppSettings from c:\MyApp\app.config" in my Trace.

Upvotes: 10

Views: 11400

Answers (1)

David Morton
David Morton

Reputation: 16505

System.Configuration.ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None).FilePath

Upvotes: 10

Related Questions