Configuration Files in .NET Framework

There is a long history of adjusting application behavior by using configuration file. Windows Applications Developer usually have two ways to put their desired configuration as follows:
  1. Putting in a ini file, such as config.ini. The INI file format is an informal standard for configuration files for some platforms or software. INI files are simple text files with a basic structure composed of sections, properties, and values. You can get more information on Wikipedia.
  2. Registering application settings in Windows Registry.
 With .NET applications, Developer can use a series of XML configuration files to control your application easily.

1. Machine.config
Located in the systemroot\Microsoft .NET\Framework\versionNumber\CONFIG\ folder, or systemroot\Microsoft .NET\Framework64\versionNumber\CONFIG\ for 64-bit machines), which defines configuration settings for the entire system.

2. Web.config
I usually see this file. Web applications will use this file to configure developers' application. It is placed at the root of a website.

3. App.config
Windows applications can be configured via an application configuration file, which also inherits from machine.config. Because the output assembly name is known only when an application is compiled, this file starts off as app.configand is renamed to application.exe.configas part of the build process.
For example, an application with AccountingApplication.exeas the main executable would have a
configuration file entitled AccountingApplication.exe.config. This configuration file is automatically
loaded based on its name when the application is loaded. If an app.configfile is added to a dll, it will be renamed to assembly.dll.configduring the build process.


Share on Google Plus

About Chien

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.

0 comments:

Post a Comment