Thursday, December 16, 2010

Sharepoint: How to modify web.config

Do you have a custom "thing" to put in your SharePoint app web.config? Worried if someone will erase you changes?
Here is my solution:
1. create in your solution folder : 12\CONFIG
2. create a custom modification  config file . Be sure that you have an extension .xml and ID  for an action is unique.
3. after deployment your custom wsp file - run the command - stsadm –o copyappbincontent. 
This command check all config files under hive/config and execute all actions for all web.configs on the farm. In case a web.config already has an action id under section "<MergedActions>", the action won't be executed again.


Some tips: for a supplement config example look under 12/Config; in case you want to re-apply a custom config action don't forget remove its custom id from MergedActions before stsadm command execution