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.|
You can use the configuration tools to customize the run-time settings of your configuration to suit a particular environment. This feature is useful if you have multiple environments that share the same basic configuration but require different property settings. For example, you may have a development environment that uses one connection string for the Data Access Application Block and a test environment that uses a different one.
Every environment you configure maintains its own environment delta file (using the file name extension .dconfig), which is updated after you save the configuration. This environment delta file contains the differences between this environment and the standard environment, plus some additional metadata for merging the differences into a new complete configuration file that you can deploy. The main advantage is that you can distribute an environment delta file separately from the original configuration file and allow management by users or administrators who have access to all the passwords, server names, and other details of that environment.
Therefore, instead of maintaining multiple configuration files or having to change a file manually or programmatically, you can create a base configuration file (.config) and an environment delta file that contains the differences (.dconfig).
To customize a run-time environment
- Create a .config file or open an existing one.
- Add the appropriate application blocks and configure them.
- Right-click Environments, point to New, and then click Environment.
- In the right pane, set the properties. The Name property is the name of the environment. The EnvironmentConfigurationFile property is the name of the merged configuration file. The EnvironmentDeltaFile property is the name of the delta file. If you want to encrypt the file, set the ProtectionProvider property by selecting a provider from the drop-down list. Repeat steps 3 and 4 for each environment you want to create.
- Click a node whose properties you want to customize. Click in the Overrides on name field, and then click Override Properties.
- Set the node's properties.
- Repeat steps 5 and 6 for each node you want to customize.
- Save the file.
- Right-click the environment node name, and then click Save Merged Configuration.
You can also merge your main configuration file and your environment delta file from the command line. This is useful if you want to use build scripts. To merge the configuration files, you must provide both the main configuration file and the environment delta file in your command. The following code example shows the syntax.
MergeConfiguration.exe configFile deltaFile [mergedFile]
The parameters are the following:
- configFile. This is the main configuration file (.config). It is merged with the environment delta file.
- deltaFile. This is the environment delta file (.dconfig). It contains the information that is merged into the main configuration file.
- mergedFile. This is the output file. This file results from merging configFile with deltaFile. If you do not specify the mergedFile, the file name stored in deltaFile is used.
|The environment delta files (.exe.dconfig) you create must be reloaded each time you close and reopen the configuration file.|
To reload an environment delta configuration file
- Start the Enterprise Library Configuration Console or open the configuration file in the Visual Studio Configuration Editor. For more information on the Enterprise Library Configuration Console see Using Alternate Configuration Sources.
- On the File menu, click Open Application.
- In the Open dialog box, browse to and select the application .exe.config file you want to reload.
- In the Enterprise Library Configuration tool, right-click Environments, and then click OpenEnvironment Delta.
- In the Open dialog box, select the environment delta configuration (.exe.dconfig) file you want to reload, and then click the Open button.
- In the Save Changes dialog box, click Yes to save the changes.