I just released a new stsadm command in the Trentacular SharePoint 2007 Features CodePlex project called smartsolutionupgrade. The purpose of this command is to perform Solution upgrades in a smart manner by performing the following actions:
- Accepts as input either a single Solution filename or a filename of a text file containing a list of Solutions to be upgraded
- Extracts and parses the Solution manifest file from each existing Solution to be upgraded in order to determine the Features that will be affected by the upgrade
- Inventories the deployment states of the existing Solutions
- Inventories the activation states of the affected Features at all scopes within the SharePoint Farm
- Deactivates all affected Features
- Retracts each of the existing Solutions and deletes them from the Solution store
- Adds the updated Solution to the Solution store
- Deploys each of the upgraded Solutions according to their previous deployment state
- Activates all affected Features according to their previous activation state
stsadm -o smartsolutionupgrade [-filename <Solution filename>] [-filenamelist <Path to text file containing each of the solution filenames on separate lines>]
Job Definition Execution
Included in the project is a Job Definition Executor that takes care of running one-time scheduled service jobs and waiting for their completion before releasing control. One particular issue addressed by the Job Definition Executor is the “A web configuration modification operation is already running” error caused by successive execution of the stsadm -o activatefeature command on Features that perform web configuration modifications.
In a multi-server farm, web configuration modifications are delegated to Timer Jobs; therefore, the return from execution of the activatefeature command does not mean the Feature activation (and thus the web configuration modification) has completed. So you might say, well duh, you need to also execute the execadmsvcjobs command, but this command simply kicks of the job execution and returns from execution while still not waiting for the jobs to actually complete.
The Job Definition Executor solves this problem by kicking of the jobs and monitoring for their completion. We can now safely execute multiple web configuration modification Features in sequence.
I just released a second stsadm command called smartexecjobdefs that simply wraps the Job Definition Executor and can be used as a substitute for the execadmsvcjobs command.