This project is read-only.
Getting started
  1. The Configuration Manager
  2. Validation configuration
  3. Encrypting configuration settings
  4. Managing differences in deployment scenarios

1) The Configuration Manager

The Configuration Manager is started by either:
  1. opening the “Configuration Console” from your start menu
  2. opening a *.config file within visual studio (this requires Avanade’s integration pack to be installed)

After opening a configuration file you should see something similar to the screenshots below.

(configuration console)

(visual studio)

In the screenshots above there are 3 areas of interest when working with CoMan.
  1. This is the treeview that represents your configuration file. Adding new configuration settings is done by right clicking nodes and adding new ones. Right clicking the nodes also gives you the possibility to validate or remove configuration settings.
  2. In the propertygrid the properties for a single treeview-node are shown. Currently “Application Settings” is selected and it gives us the possibility to set the “File” property.
  3. Below the propertygrid you can find “Commands”. These hyperlinks can be used to perform frequent tasks on the node shown in the propertygrid, such as looking up documentation on MSDN and (specifically for “Application Settings”) adding new appSettings.

After opening the configuration we are ready to roll. Lets add an appSettings by clicking the “Add new Item” hyperlink (1) and type in “SmtpServer” for its Key and “” for its value (2). Also notice a new command appears below to remove the newly created settings (3).


2) Validating configuration settings

Configuration settings are validated prior to being saved to the configuration file. Trying to save two appSettings with the same value (1) gives us a configuration error (2). Configuration can also be validated by rightclicking the treeview-node and hitting "Validate (CtrlShiftv)"- menu option.


3) Encrypting configuration settings
Encrypting configuration settings is done by first adding a "Configuration Protector" node to the configurations treeview. Right-click the rootnode (web.config) and choose "New" -> "Configuration Protector". The Configuration Protector Node is added to the configurationfile and allows us to choose a method of encryption (in the propertygrid called "ProtectionProvider").

After adding a configuration protector some new properties appear in the propertygrid. When opening our "Application Settings" node in the propertygrid we find a property called "Protect on Configuration Protector". Setting this value to "True" will encrypt this part of the configuration when saving to a configuration file. The default for this property is "False", which saves the settings as clear-text

4) Managing differences in configuration over deployment scenarios
When deploying an application there might be differences in the configuration file that should be deployed. Other settings should be kept in sync. with the ones we one in our development environment.
To make the process of managing these differences easier, we add a "Environmental Overrides" node to the configuration file.

Right-click the rootnode (web.config) and choose "New" -> "Environmental Overrides". This adds the "Environmental Overrides" node to the treeview including 1 deployment environment, which is called "Production Environment" (1). For each deployment environment we have we can now add new environment-node below the "Environmental Overrides" node.

After adding all the environments we have, again new properties appear in the propertygrid (2). This time they are called "Overrides on environmentname]" and allow us to choose to either "Dont override properties" or "Override properties".

After selecting "Override properties" on the "Application Settings" node, we can conveniantly change the value of the "SmtpServer" setting into something more suitable for our production environment.

Saving the configuration file will now update 2 files: the one we opened intially and another to deploy to our production environment. The second configuraiton file can be found in a sub-directory that was specified on the "Production Environment"-node.

Last edited Jul 7, 2006 at 9:40 AM by OlafConijn, version 10


No comments yet.