Solution Activation Dependencies in SharePoint 2010
In SharePoint 2007 you could already define feature activation dependencies when the availability of a certain feature was required before you could successfully activate a depending feature. This functionality almost worked perfectly, except that it does not deactivate depending features when a parent feature is deactivated. This has not changed in SharePoint 2010.
But in SharePoint 2010 we now have an additional feature: we can now define solution activation dependencies. It works almost similar as feature activation dependencies. When you deploy a solution with an activation dependency, SharePoint will check if this parent solution is already deployed. If not, you will get an error message. SharePoint 2010 will not deploy the parent solution for you. Solution dependencies are checked during deployment, not when adding to the solution store. If you retract a parent solution, SharePoint 2010 will not retract the depending child solutions.
Solution dependencies must be defined in the solution manifest, i.e. the manifest.xml file in your wsp package. If you work with the Visual Studio 2010 tools for SharePoint 2010 you have to:
1. Double click the package element from within Solution Explorer.
2. The Package Designer opens. Unlike the Feature Designer, there is no UI available to define the solution activation dependencies, you have to add it manually to the manifest. At the bottom of the Package Designer you will find the Manifest button. Click it to show the CAML within the manifest.
3. At the bottom of the designer you will see a Edit Options section, which you can expand. You are proposed with an empty <Solution> element. Add a <ActivationDependencies> element, in which you can add one ore more <ActivationDependency> elements. You have to specify at least the ID of the parent solution on which activation depends.
You can find the ID of the parent solution by opening its Package Designer. While in the Package Designer of the parent solution, you can find the the guid in the Properties window:
4. When you try to deploy the child solution, which in my sample is the web part solution, without having deployed the parent solution containing a number of list definitions, you will get following error message.
5. The only problem is that it only mentions the solution ID. You can make it more user friendly by adding the SolutionName attribute, which is optional.
The error message changes as follows:
7. I also tried to add the SolutionTitle as the MSDN reference article describes, but it didn’t change the error message.
Remark: the SolutionName should be identical to the name of the parent solution. It is not important when trying to deploy the child solution when the parent solution is not yet uploaded, but it is checked when the parent solution is already deployed.
Solution dependencies work for both farm solutions and sandboxed solutions, and it should also be possible to add a solution dependency on a farm solution from within a sandboxed solution, but I haven’t checked that.