|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
Upgrading a Solution
This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
Upgrading a solution involves replacing a previous version of a solution with a current version of the solution. Specifically, an upgrade occurs when a solution is deployed that shares a solution ID with another solution.
During upgrade, files that are associated with the previous version of a solution are removed, and files contained in the current version are added.
Each time a solution is successfully upgraded, the previous version of the solution is backed up and stored in the configuration store. This backup is used by the solution framework in the case of an upgrade failure. Only a single backup copy is stored per solution.
Solution upgrade can only be used to replace files. You can add new files in a solution upgrade and remove old versions of the files, but you cannot install Features or use Feature event handlers to run code for Feature installation and activation. The following operations are not supported in solution upgrade.
Removing old Features in a new version of a solution.
Adding new Features in a solution upgrade.
Updating or changing the receiver assembly for existing Features in a new version of a solution.
Adding or changing Feature elements (Element.xml files) in a new version of a solution.
Adding or changing Feature properties in a new version of a solution.
Changing the ID or scope of old Features in a new version of a solution.
Removing Feature elements (Element.xml files) in a new version of a solution.
Removing Feature properties in a new version of a solution.
For a solution upgrade to run, the solution must be present in the solution store. It may or may not already be deployed; the following rules apply based on whether the solution is deployed.
If the solution is not deployed:
Use the SPSolution.Upgrade(String) method to upgrade the solution in the solution store. A backup of the original solution is created.
Do not call the SPSolution.Upgrade(String, DateTime) method. This method results in an error because you cannot schedule upgrade for a specific time if the solution has not been deployed.
If the solution is deployed: