Anyway, so we have loads and loads of settings for our applications some are:
- specific to the application
- specific to the configuration/environment
- generic to all of the applications
Most of our applications are ASP.NET 2.0 web apps, and therefore we had previously stored our settings data inside web.config under the
Then last year we need to split out the settings on a per-configuration / environment basis, so we created a /_config/ directory in the root of our web app.
In this we placed
- /prod and
The principle is simple: just create appSettings.config and place it inside /dev, then reference it from web.config with the "file" attribute of the appSettings node; e.g. web.config ->
The file attribute will mean the contents of the specified file will override and merge with nodes directly underneith the inline
But the problem is, we actually don't want to maintain settings that are shared amongst different applications inside web.config. This is because if one setting needs to change, you need to specify the change throughout all web.configs of all applications.
We can't "share" the web.config amongst all applications, as each app needs different web.config sections / settings for other stuff. Also, we can't share a section of web.config.
So how can we find a neat solution to just:
- Store and share settings that are agnostic to the application, the environment in which the application is deployed and are essentially global to a company's apps.
- And also, specify settings that are the opposite: i.e. settings that are specific to the app and the environment.
I had tried using a heirarchy of file attributed
The Use Of The File Attribute and Config Source Attribute
arrrrh! that's the one.
So the solution is to put inside web.config:
[no inline nodes allowed]
Inside GenericAppSettings.config put:
Then create dev\appSettings.config
In our source control management system (VSS), we then share GenericAppSettings.config, amonst all of our apps and now we can rest assured that nothing will be left as obselete or broken. i.e. Generic settings can now be updated once for the whole enterprise.
so there you go another great solution for configuration management!