I have a console application that has App.Confile file. Now the parameters that are environment specific are maintained here.
Now I am thinking to have multiple app.config files (like app.dev.config, app.test.config and app.prod.config) the way how we can have multiple Web.Config files.
In case of Web application, we can handle this and ConfigurationManager would pick respective Web.Config file.
In case of Console application, I am not sure. If Yes, how can we have multiple app.config files?
Appreciate your help.
Thanks
These apps have two configuration files: a source configuration file, which is modified by the developer during development, and an output file that is distributed with the app.
Yes you can have two web. config files in application.
Yes, in large projects, having multiple Spring configurations increase maintainability and modularity. You can also upload one XML file that will contain all configs.
To follow on from Babak's answer, you could also separate parts of your config out into other config files by using the configSource
attribute on any element which represents a ConfigurationSection
, e.g.:
<appSettings configSource="appSettings.config" />
And in appSettings.config:
<?xml version="1.0" encoding="UTF-8"?>
<appSettings>
<add key="Blah" value="Nim nim nim" />
</appSettings>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With