The Enterprise Library Configuration Tools

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

The latest Enterprise Library information can be found at the Enterprise Library site.

Application blocks are designed to be used in a variety of enterprise application development scenarios. This design approach allows you to easily adapt an application block to meet the needs of your situation. You do this with configuration settings, which you can easily change using the configuration tools. You can define configuration settings for an application block's central functionality and for each provider type.

You can use Visual Studio to create and modify configuration files or you can use the stand-alone Enterprise Library Configuration Console. Collectively, the Configuration Editor and the stand-alone Configuration Console are referred to as the configuration tools. Both of these configuration tools have identical functionality. With these tools, you can change and validate application block settings without manually editing the XML configuration files where they are stored. The configuration tools display these settings and supply default values that you can change.

Each application block defines points of extensibility, where developers can include their own implementations (typically, these are providers) with specific functionality. For example, you can add your own custom backing stores to the Caching Application Block. These custom providers can be interchanged with the providers that are supplied with the application block. The Configuration Console lets you select the custom backing store and writes this information to the appropriate XML configuration file. This means that the application will use the custom store without any code changes and without being recompiled.

Figure 1 illustrates the Configuration Console user interface.


Figure 1
The Configuration Console user interface

The Visual Studio integrated configuration tool is named the Configuration Editor. The Configuration Editor has the same functionality as the stand-alone Configuration Console, but it uses the Visual Studio Properties window to display an application block's properties and uses the errors list to display configuration errors.

The following describes some of the activities the configuration tools help you with:

  • You can use the configuration tools to create and modify standard .NET Framework <appSettings> sections. For more information, see Using the appSettings Section.
  • You can use the configuration tools to tailor an application block's configuration to a particular run-time environment. For more information, see Environment-Specific Configuration.
  • You can use the configuration tools to encrypt and decrypt the data contained in configuration sections. For more information, see Encrypting Configuration Data.

Using configuration settings to adapt an application block to a particular situation has two advantages:

  • Different people can configure the characteristics of an application block at different times during the application life cycle. For example, a developer could configure a provider to access a particular database during application development, while a system administrator could decide during deployment to encrypt the database connection strings.
  • You can change the application block configuration incrementally for increasingly complex situations. For example, you could initially configure an application block to use the default settings and providers. As your understanding of the scenario deepens and as your expertise grows, you can change the application block configuration without modifying its code, recompiling it, or redeploying it.

Using the Visual Studio Configuration Editor

The Configuration Editor is integrated with Visual Studio. It uses the standard Visual Studio operations to create, open, and save a file. You can open a configuration file by double-clicking it in Solution Explorer. You can also point to Open on the File menu and then click File and navigate to the file you want to open.

If your file is under source control, the usual rules apply. You can only save changes to a file if you have first checked it out.

The Configuration Editor uses the standard Visual Studio windows and lists to display information:

  • The main Visual Studio window displays the configuration hierarchy.
  • To display and edit a configuration node's properties, you must first select the node in the main window.
  • The standard Visual Studio error list displays any configuration validation errors.

Using the Configuration Console

To use the Configuration Console, click Start on the taskbar, point to All Programs, point to Microsoft patterns & practices, point to Enterprise Library 4.1 — October 2008, and then click Enterprise Library Configuration.

Building the Configuration Console

Enterprise Library includes an executable file for the Configuration Console that is located in the correct directory. However, if you customize the Configuration Console source code, you may need to re-compile the source code. You can use the BuildLibrary batch file to do this.

The Configuration Console requires the application block assemblies to be located either in the same directory as the Configuration Console executable file or in the global assembly cache. It requires both the run-time assemblies and the design-time assemblies. Each application packages the design-time support in assemblies that are separate from the run-time implementation. These assemblies are not required for running an application that uses the application blocks. However, the Configuration Console uses them when you change an application block's configuration. The required assemblies have the suffix Use the CopyAssemblies batch file to copy the required run-time and design-time assemblies into the bin directory.

Alternatively, you can use the BuildLibraryAndCopyAssemblies batch file to recompile the source code and copy the run-time and design-time assemblies into the bin directory.

For more details about the relationship between the run-time configuration component and the design-time configuration component, see Design-Time Configuration.


When the Configuration Console opens an application configuration file, it attempts to load all the provider assemblies referenced in that file. If your application configuration includes a custom provider, you must make the custom provider assembly available to the Configuration Console. To do this, you can copy the assembly to the same directory as the Configuration Console executable file or install it into the global assembly cache. You can also use the DEVPATH environment variable to allow the Configuration Console to locate the custom provider assembly.