Split Config files in several files

6. January 2011 10:25 by Mrojas in General, WCF  //  Tags: , ,   //   Comments (0)

In .NET Framework 2.0 the attribute configSource was added to several elements of the .NET config files so you could use external files.

Sadly those attribute are not available for the system.serviceModel.However I found this post that shows a interesting workaround.

You can modify your serviceModel file to look like this:

<configuration>
 
  <system.serviceModel>
    <services configSource="Services.config" >
    </services>
 
    <bindings configSource="Bindings.config">
    </bindings>
 
    <behaviors configSource="Behaviors.config">
    </behaviors>
 
  </system.serviceModel>
 
</configuration>

And then you can put your configuration settings in separate files like the following:

Behaviors.config

<configuration>
 
  <system.serviceModel>
    <services configSource="Services.config" >
    </services>
 
    <bindings configSource="Bindings.config">
    </bindings>
 
    <behaviors configSource="Behaviors.config">
    </behaviors>
 
  </system.serviceModel>
 
</configuration>

For more details see the full post by Pablo Cibraro