Merge Environmental Overrides for Cutom Values

Topics: Building and extending application blocks, Enterprise Library Core, General discussion
Jun 28, 2008 at 4:23 PM
Edited Jun 30, 2008 at 3:48 PM
The Environmental Overrides feature ROCKS!  I've been able to override many of my environment specific values.  However, the Ent Lib Configuration UI only has support for EntLib sections.

I have several WCF Services in my system.servicemodel app config that use a certificate.  This certificate varies from environment to environment.  I'd like to use the Environmental Overrides feature to merge the correct the certificate name for each environment.

I also have some custom configuration sections that require overrides but do not have a name attribute on the section header.

I don't mind manually creating entries in my .dconfig files, but I'm not sure I understand how I would path them.  Is there any documentation on manually editing this file or is there another UI tool that will let me override non EntLib sections in my configuration file?

Update -- I've tried to modify the dconfig file to add overrides for non-entlib sections

For example...

        <section name="EnvironmentMergeData" type="Microsoft.Practices.EnterpriseLibrary.Configuration.EnvironmentalOverrides.Configuration.EnvironmentMergeSection, Microsoft.Practices.EnterpriseLibrary.Configuration.EnvironmentalOverrides, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    <EnvironmentMergeData environmentName="SdxDev" environmentDeltaFile="NotificationServiceHost.exe.config.sdxdev">
            <override nodePath="/Logging Application Block/Trace Listeners/Rolling File TraceListener"
                    <add name="RollSizeKB" value="2000" />
          <override nodePath="/NotificationChannelEmailConfig"
              <add name="SmtpHost" value="smtp-sdxdev" />
              <add name="SmtpPort" value="20" />

The MergeConfiguration.exe returns success, and my logging changes are applied, but the changes to the NotificationChannelEmailConfig section (which is off the root, just like my logging configuratin block), does not get changed.

What am I doing wrong?  Are overrides for custom configuration sections not supported by the MergeConfiguration engine?

Jun 30, 2008 at 5:46 PM

The merging functionality relies on the ability to load a configuration file into configuration nodes, which means you can only specify overrides to the configuration elements the tool already knows about. There were some efforts to include support for System.Web and System.ServiceModel before, but I don't know if they are up to date.