Using the appSettings Section

Microsoft Enterprise Library 5.0

DropDown image DropDownHover image Collapse image Expand image CollapseAll image ExpandAll image Copy image CopyHover image

You can use the configuration tools to create and modify Microsoft .NET Framework <appSettings> sections. Note that the <appSettings> sections must be included in a single file; they should not be distributed across multiple files. Examples of files that you cannot edit include the Machine.config file and <appSettings> sections that include the optional file attribute that specifies a relative path to an external configuration file.

Configure an <appSettings> Section Using the Configuration Tool

To configure an <appSettings> section

  1. Open the configuration file. For more information, see Using the Configuration Tools.
  2. On the Blocks menu click Add Application Settings.
  3. Click the plus sign icon for Application Settings, and then click Add Setting to add a setting.
  4. Set the Key and Value properties in the Setting properties pane.

Configure an <appSettings> Section by Editing the XML

You can also edit the application settings by directly editing the XML in the configuration file. You can add and remove keys at design time as shown in the following example.

XML Copy Code
<appSettings>
  <add key="key1CurrentFile" value="value1forKey1InCurrentFile"/>
  <remove key="key2InCurrent" />
</appSettings>

For more information on the XML elements, see .NET appSettings Element on MSDN®.