I use external config files for various dynamic sections in my web.config files. Essentially all the dynamic variables between environments (Prod, UAT, Test, Dev etc.) have been externalised out to generic named .config files.
My web.config is generic as well so all environments utilise the same web.config (as things like connection strings etc. are in the external files). All the files are named the same across the environments so when we do a release we just need to keep the web.config and \Configs* directory in tact during a release.
What I want to do (via something like XSLT or PowerShell) is to merge all of the information contained within these external *.config files back into the web.config so that I can compare the (now merged) web.config with the version provided by developers.
So our present web.config may say:
<sessionState configSource="Configs\System.Web.SessionStateConnectionString.config" />
And in the System.Web.SessionStateConnectionString.config file for the Prod environment has:
<sessionState mode="StateServer" cookieless="true" timeout="20"/>
And for the Test environment has:
<sessionState mode="InProc" cookieless="true" timeout="20"/>
I'd like to merge in all the external *.config files back into a web.config so that the file is essentially completed as if configSource had never been used. This will allow me to perform a diff or WinMerge on the web.config file (after it's been merged back) and what the developer gives us, showing which things have been changed such as new keys added or new modules utilised.
What would be the best way of going about this?