Jay Nathan's Weblog
Thursday, May 27, 2004
.NET Configuration Files
Microsoft .NET configuration files differ with the type of application you are developing. If we are dealing with ASP.NET, the configuration file is called "web.config" and will reside in the root of the virtual directory where your application lives.

For executable applications, though, we use the app.config file. There is no configuration file option for class libraries (dll's). If you need to load configuration items into a class library at run time, they must be loaded from the executing assembly's (exe) configuration file. When you compile an executable project that contains an "app.config" file, you will notice that a copy of that file is placed in the same directory that the executable saved to, but with a different name: <app_name>.exe.config. From run time, reflection is used to retrieve the proper configuration file from the APPBASE directory. Since configuration files are named after the executables that they configure, you can have multiple executables in one directory, all with their own configuration files which you couldn't do by default if the configuration filename was left as app.config.
Comments: Post a Comment

<< Home

Powered by Blogger