O'Reilly logo

Professional Visual Studio 2012 by Bruce Johnson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 37

Configuration Files

WHAT’S IN THIS CHAPTER?

  • Understanding the .NET configuration system
  • Using configuration files within your application
  • Storing custom types in configuration files

One of the challenges to build applications is adjusting the way the application functions on-the-fly without having to rebuild it. There’s a long history of applications using configuration files to control the way an application runs. .NET applications use a series of XML configuration files that can be adjusted to determine application behavior. This chapter explores the structure of these configuration files and demonstrates how you can store custom information using a configuration section handler.

.CONFIG FILES

The .NET Framework configuration system consists of several configuration files (discussed in the following sections) that can be used to adjust one or more applications on a computer system. Part of this system is an inheritance model that ensures that configurations can be applied at the appropriate level. This model is such that sections defined in a configuration file at a lower level override the same sections specified in a file higher up the chain. If no configuration file defines a value or section, the default values are taken from the schema files to which the configuration files must adhere.

Machine.Config

At the root of the inheritance model is the machine.config file (located in the systemroot\Microsoft .NET\Framework\versionNumber\CONFIG\ folder, or systemroot\Microsoft ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required