SharePoint Automated Deployment
As part of a major project for one of our clients there was a requirement to simplify the deployment process of all the developed features. Nine features had been developed, this included Event Handlers, Custom Pages and Workflows, all with different deployment requirements. To deploy these features manually would require:
- Extensive use of the Stsadm command line tool or a combination of the Stsadm command line tool and the Solution Management functionality of Central Administration.
- Manually copying the required files for the Custom Pages to the SharePoint Hive.
To overcome the need for the user deploying the features to have knowledge of the Stsadm command line tool and Central Administration, as well as speeding up the overall process, a windows application was developed that would allow for (almost) “One Click” deployment.
The application was designed to run on the SharePoint Server itself and would be packaged with the required wsp’s and any support files. The application only requires that the user who is running it select the Site the features are to be installed against, the location of the installation files and the location of the SharePoint Hive. From there the user only needs to click the install button and the application will proceed to install all the features (and uninstall any previous versions if present) and copy any required files to their relevant locations. While the installation process is running the user is provided with a progress bar as well as a real time log showing the success/failure of the feature installations and file copying.
From developing this application there are a couple of points which would benefit from being highlighted:
- To deal with the potential different scopes required for the deployment of the features, there are several different xml configuration files contained within the deployment package; each one representing a different installation scope. These files contain the names and feature id’s of the features that are to be installed at that scope. There is also an xml configuration file for any files that need to be copied which includes the name of the file and the destination location.
- Initially when developing this tool the adding of the solution, deploying of the feature and activation of the feature were all done by using a System.Diagnostics.Process object which in turn was used to run Stsadm commands, however using these commands required the creation and execution of timer jobs to deploy a feature which in turn caused issues in trying to get timings between the execution of the three Stsadm commands correct. A time delay was added between the execution of these steps but this resulted in some unpredictable results. As an alternative to this method the installation code was changed to use the SharePoint Object Model to perform the installation. This overcame the issue of requiring a time delay as deploying a feature via the Object Model did not encounter the same timing issues.
- The application is required to be run as an Administrator to allow for the installation and activation of features.
All configurations for the application are contained within the configuration xml files and as such it can be reused for any further deployments on the same installation or any other SharePoint installations.

