Jeffrey Palermo (.com)

Sponsors

The Lounge

News

Advertisement

Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
Reading in config files _one_ way - what's the path?

Executive summary:  AppDomain.CurrentDomain.SetupInformation.ApplicationBase

Subscribe here: http://feeds.feedburner.com/jeffreypalermo.

In a console app, this directory is where the assemblies are.  In ASP.NET, this directory is where the web.config file is, not the assemblies.  Other methods seem to be less reliable and rely on the current directory.  This can change whether the code is executing stand-alone or through Visual Studio.  the above API seems to be very consistent.

Please share your experiences.


Posted 01-10-2008 7:17 AM by Jeffrey Palermo

[Advertisement]

Comments

Loading “collocated” file dependencies at runtime | Aaron Lerch wrote Loading “collocated” file dependencies at runtime | Aaron Lerch
on 01-10-2008 8:51 AM

Pingback from  Loading “collocated” file dependencies at runtime | Aaron Lerch

Aaron Lerch wrote re: Reading in config files _one_ way - what's the path?
on 01-10-2008 10:22 AM

Well the pingback beat me to it, but I have a post that lists some ways to determine "collocated" files (like .config files).

www.aaronlerch.com/.../loading-collocated-file-dependencies-at-runtime

Francois Tanguay wrote re: Reading in config files _one_ way - what's the path?
on 01-10-2008 12:31 PM

Just remember than in VS2008, runnint tests with VS Tests, this value leads incorrect results.