0
votes

I have got 4 .net console applications which carry out different tasks. These 4 applications share some common configuration that I pass through app.config file. Can I put all the configuration in one common config file and read from that instead of each of the 4 applicationname.exe.config file?

2

2 Answers

1
votes

You can use ConfigSource. Basically they allow you to reference different files within your app.config.

here is how it would work,

<configuration>
  <system.serviceModel>
    <services configSource="External.config" />
  </system.serviceModel>
</configuration>

External.config

<services>
   <!-- Put what you were going to put in the Service element-->
</services>

what you need to do is to 'refactor' the common parts from all the config files to external files and reference them from your main config files.

0
votes

Yes you can do that. if you create a separate configuration project and refer to them from your different projects you can access the same key/value pairs. ie; configuration.

Look at my previous question.