Use of configuration data when using STSADM.EXE to activate custom Features in SharePoint 2007
Posted
Saturday, December 09, 2006 6:59 PM
by
mhodnick
When implementing a custom Feature in SharePoint 2007, you may rely on custom configuration data (in a custom configuration section) stored in a SharePoint site's web.config file. When activating and deactivating your feature through the SharePoint site settings user interface, this works just fine. However when using the STSADM.EXE command-line tool to activate and deactivate features, there is no web context and the tool does not run within the context of a SharePoint site. Thus if your feature relies on custom configuration data in a config file, the configuration data will not be available when using STSADM.EXE.
You can address this problem by creating (or modifying) a file named STSADM.EXE.config that resides in the same folder as STSADM.EXE (c:\program files\common files\microsoft shared\web server extensions\12\bin). This file is just an application configuration file (e.g. app.config), and you can add custom configuration data to it like any other web.config or app.config file. Keep in mind that this is a server-wide config file. Any customizations or changes you make will affect all uses of STSADM.EXE on all sites on the server.