web analytics

How to split app.config file into multiple files?

Options

davegate 143 - 921
@2016-02-22 22:27:30

I'm trying to split an app.config file into multiple files to make it easier to manage the differences needed for different environments. With some sections it was easy...

<system.diagnostics> 
    various stuff 
</system.diagnostics> 

became

<system.diagnostics configSource="ConfigFiles\system.diagnostics.dev" /> 

with the "various stuff" moved to the system.diagnostics.dev file.

But for the system.serviceModel section this doesn't seem to work.

Now I've read suggestions that it doesn't work for system.serviceModel itself, but it works for the sections underneath it: bindings, client, diagnostics, etc. But the same thing happens to me when I try to use configSource with one of them. When I put in

<system.serviceModel> 
  <bindings configSource="ConfigFiles\whateverFile.dev" /> 

I get:

The 'configSource' attribute is not declared.

Has anyone else seen this? Do you know a solution?

@2016-02-22 23:42:22

I have config like this:

  <system.serviceModel> 
    <behaviors configSource="config\system.servicemodel.behaviors.config" /> 
    <bindings configSource="config\system.servicemodel.bindings.config" /> 
    <client configSource="config\system.servicemodel.client.config" /> 
  </system.serviceModel> 

which works fine.

Comments

You must Sign In to comment on this topic.


© 2024 Digcode.com