38.2. Configuration Schema

A configuration file, whether it is a machine.config, a web.config, or an application configuration file, needs to adhere to the configuration schema that determines which elements should be included. The schema can be found at C:\Program Files\Microsoft Visual Studio 9.0\Xml\Schemas\DotNetConfig.xsd and is broken down into a number of sections.

38.2.1. Section: configurationSections

Configuration files can be customized to contain any structured XML data. In order to do this, you must define a custom section in the configurationSections block within the configuration file. This defines both the name of the configuration section and the class that is to be called in order to process the section.

The first configurationSections section in the machine.config file defines the handlers for each of the standard configuration sections discussed here. For example, the following code snippet defines the section handler for the ConfigurationApplication.My.MySettings configuration section, along with the corresponding section. The schema of this section must correspond to what the System.Configuration.ClientSettingsSection class expects, rather than the normal configuration file schema.

<configuration> <configSections> <section name="ConfigurationApplication.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> </configSections> ... <ConfigurationApplication.My.Settings> ...

Get Professional Visual Studio® 2008 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.