.config file not loaded from working directory

Posted by Phil Coveney on Stack Overflow See other posts from Stack Overflow or by Phil Coveney
Published on 2010-04-06T15:12:54Z Indexed on 2010/04/06 15:23 UTC
Read the original article Hit count: 264

I am new to using .config files, having worked on apps that use .INI files and the registry until very recently. I am seeing a behavior in VS2008 that I would not anticipate, and wonder if it is the expected one.

When I configure the Working Directory setting in the VS2008 IDE for my Foo.exe application, I would have guessed that Foo.exe.config would get loaded from that Working Directory. It does not; it gets loaded from the ..\bin\Debug directory, even if I have a Foo.exe.config file in that Working Directory. If I examine the Environment.CurrentDirectory while the configuration is being applied by setting a breakpoint, I see that it is ..\bin\Debug. When I examine the Environment.CurrentDirectory after my main UI's Loaded event, it is set to the Working Directory I applied in the IDE.

Is this correct? (Why?)

© Stack Overflow or respective owner

Related posts about visual-studio-2008

Related posts about configuration