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?
Asked
Active
Viewed 483 times
2 Answers
1
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.

kay.one
- 7,622
- 6
- 55
- 74
0
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.

Community
- 1
- 1

DarthVader
- 52,984
- 76
- 209
- 300