Uninstallation and Retraction of a Farm Solution
This topic describes what is happening in the background when a farm solution is retracted and uninstalled.
Applies to: SharePoint Foundation 2010
Retraction and uninstallation can be done with either the Central Administration application or SharePoint Management Shell. See Technet for information about how to do these tasks.
Major Steps of Uninstalling a Farm Solution
There are two or three major steps to uninstalling a farm solution:
Feature Deactivating: If a farm solution includes one or more Features, these should be deactivated first. This can be done in the Features Gallery where the Feature was activated. Deactivation reverses the deployment of assemblies in the Features. However, other files from the Feature remain deployed, unless the Feature has a Feature Receiver whose FeatureDeactivating(SPFeatureReceiverProperties) handler has been overridden to remove the files. If the Feature contains components that can be managed in Microsoft SharePoint Designer, deleting the component in the designer will remove the files.
Retracting: The deployment of the farm solution's components is reversed. This step requires a farm administrator and can be done with either Central Administration, SharePoint Management Shell, or the object model. Retracted solutions are not removed from the farm's solution store and can remain stored there in an undeployed state indefinitely.
Removing: Deletes the solution package from the solution store. This step requires a farm administrator and can be done with either Central Administration, SharePoint Management Shell, or the object model.
SharePoint Foundation is not consistent in its terminology with regard to installation and uninstallation of farm solutions. The terms Adding, Deploying, and Activating are the most commonly used to refer to the three steps of installation; but depending on what tool is used to carry out a step, you will see a variety of terminology. The second step, for example, is called deploying in Central Administration, but installing in SharePoint Management Shell. There is a similar inconsistency in the terms for reversing these steps; but most commonly, reversing the second step is called retracting (but it is called uninstalling in SharePoint Management Shell) and reversing the first step is called removing. The third step, which applies only to Features, is always called activating, and its reversal is always called deactivating.
Details of the Retraction Step
Retracting a solution is the process of removing assemblies, files, resources, safe control entries, Features, and other solution components from computers to which they have been deployed.
The following are two critical points to remember about retraction of a farm solution:
A solution cannot be removed from the solution store until after it is retracted.
When a solution is retracted, all files for that solution are retracted, even if another solution points to the same file. This issue can be avoided by ensuring that each solution points to a unique set of files.
It is possible to retract a solution from some web applications while leaving it deployed for others.
In a complete retraction, features are uninstalled first from front-end web servers in the farm. If the solution is web application–specific, solution global files (if any) are removed when the solution is retracted from the last web application to which it is deployed.
Next, Features are uninstalled from databases. Feature-by-Feature, elements are removed from the configuration store.
Finally, files are removed from servers in the farm. On individual servers, files that are associated with the Features and site definitions are removed.
On each front-end web server, the following occurs:
Internet Information Services (IIS) is disabled.
Files are removed from the system.
IIS is re-enabled and Microsoft SharePoint Foundation is reloaded when a user browses to a page.
Farm administrators can specify the time when the retraction occurs.