Automatic merge of config files

Y

Yash

In our production environments we have the app.config files for
version 1.0 of our app. On each server the file contains a number of
settings including connection strings, WCF endpoints etc. which were
made by the deployment engineer.

When version 2.0 is released, it will have a number of more sections
added to the config file. We would like to merge the new config file
with the existing one such that:
-For sections and parameters that have not changed, the existing
setting will be retained.
-New sections will be added with the values as given in the new config
file.
-Sections that have been deleted in the new file will be deleted from
the existing file.

Is there a tool to do this automatically?

Thanks,
Yash
 
S

sloan

You can clean it up a little like this:

This will allow you to granularize the settings.
The only downside is that with an update to web.config , you get a recycle,
(thus a fresh "read").
Changing these values in the subfiles won't recycle.

The other nuance is that you have to write post build events to copy the
files into /bin/ if you're doing anything besides an web application.




<?xml version="1.0" encoding="utf-8" ?>
<configuration>

<appSettings file="CustomAppSettings.config" >
</appSettings>

<connectionStrings configSource="ExternalConnectionStrings.config" />

<system.serviceModel>
<behaviors configSource="WCFBehaviors.config">
</behaviors>
<bindings configSource="WCFBindings.config">
</bindings>
<client configSource="WCFClient.config" >
</client>
<services configSource="WCFServices.config" >
</services>
</system.serviceModel>
<system.diagnostics configSource="SystemDiagnostics.config">
</system.diagnostics>

</configuration>



There are too many files to put there, but here is ONE example of the
external file:


//WCFBehaviors.config <<
<behaviors>

<serviceBehaviors>

<behavior name="DefaultThrottlingBehavior">

<serviceThrottling maxConcurrentCalls="25"

maxConcurrentSessions="25"

maxConcurrentInstances="25" />

</behavior>

</serviceBehaviors>

</behaviors>

//END WCFBehaviors.config <<


For an empty file, you can just have something like this

//START WCFClient.config (This is my client file on the SERVER side..thus
its empty
<client/>

//END WCFClient.config

I keep all this stuff granularized because its makes for a tidier app.config
or web.config.
Geeze, those things can get big fast!


This isn't an exact answer to your question, but I think it will provide
some value to you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top