In this article, I am going to write about having Supplement Web.config files for all your custom config settings
Approach:
In the approach You can make use of 14/Config folder. You can generate Custom Web.config XML file and deploy to this folder. When New Web Application is created or Web application is extended, Foundation Server will copy all content of XML files Located in 14/config to root folder’s web.config file
You need to make sure about
1) Naming the XML, The xml has to be named WEBCONFIG.*.XML
2) Tags, you need to use <Actions> <add> tags as shown below
Sample XML
<?xml version=”1.0″ encoding=”utf-8″ ?>
<actions>
<Add path=”configuration/appSettings”>
<add key=”SampleKey” Value=”SAmpleValue” />
</Add>
You can Push custom config setting from 14/Config to root folder’s Web.config by running below command as well, This is specially use full for existing application.
stsadm –o CopyAppBinContent
Packing XML to WSP
You can deploy Custom Web.config to 14/Config folder by packaging it to WSP by mapped folder.
Benefits
1) Custom Configuration in Web.config is not lost up gradation of server like installing Service Pack