tags:

views:

34

answers:

2

I have run into several instances recently where I have had trouble figuring which .config file a given application or DLL is referencing. I've been able to figure it out through some trial and error, but I'm hoping there is a better way. I'd really like to hear some suggestions.

Thanks!

+5  A: 
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
Console.WriteLine(config.FilePath);
Darin Dimitrov
+1, also with Trace.WriteLine(config.FilePath) and view with DebugView on any machine/app with http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx.
kenny
+1  A: 

If it's running then you can use Process Explorer (by Sysinternals, now Microsoft) to examine the file handles a process has.

Hope that helps.

Tom Duckering