Did you know: configuring Solution Dependencies in SharePoint 2010


When SharePoint 2007 shipped with the Features and Solutions framework we thought we had it all sorted out. We were able to package our work and deploy it in a structured and repeatable manner. Using Feature Activation Dependencies we were able to ensure that all the functionality that our components require are available prior to provision our custom functionality. And while Feature Dependencies are definitely a great concept they are unfortunately incomplete. If all the different pieces come from a single Solution then Feature Dependencies are sufficient. However if your resources are spread across different Solution the only piece of feedback you will get from Feature Dependencies is message saying that a Feature with some id is missing in your Farm. Luckily this situation has changed with SharePoint 2010 and the introduction of Solution Dependencies.

What is?

Solution Dependencies are a new concept in SharePoint 2010 and are very similar to Feature Dependencies. From the functional point of view they allow you to specify additional resources that are required for your Solution to work properly. Technically there are some differences between Feature and Solution Dependencies.

As you might have known, if you configure the Feature Dependencies in such way, that your Feature depends on another Feature which is hidden, that hidden Feature will be automatically activated if necessary prior to activating your Feature. Visible Features don’t get automatically activated and SharePoint returns an error message saying that another Feature must be activated before you can activate yours. If you specify a Solution Dependency to another Solution which hasn’t been installed/deployed yet, SharePoint will not do anything about it, and all you will get is an error message saying that the particular Solution is missing. This is a great validation mechanism for you to ensure that all resources required by your Solution have been deployed correctly.

Solution Dependencies 101

Specifying Solution Dependencies is very easy. You can specify one or more dependencies using the ActivationDependency Element in the Solution Manifest, for example:

<Solution>
  <ActivationDependencies>
    <ActivationDependency SolutionId="00000000-0000-0000-0000-000000000001"/>
  </ActivationDependencies>
</Solution>

Then during the deployment process SharePoint will check if all Solutions specified in the ActivationDependencies section have been deployed and will return an error message if one or more solutions have not been found:

Error message saying that a solution cannot be activated because it depends on another solution which doesn't exist.

As you can see the error message takes you a step further but it’s still not very useful providing only the Solution ID. This is quite useless especially if you’re working with third party Solutions and the only way to get the Solution ID is to extract the Manifest.xml from each Solution Package.

That’s why SharePoint allows you to provide additional information for every Solution Dependency. While SolutionId is the only value required you can also include the name of the Solution file, the Title of the Solution and its url (?). Of all this information only the Solution filename is being included in the error message:

Error message saying that a solution cannot be activated because it depends on another solution that doesn't exist. Next to the solution Id also the solution filename is being named.

At this moment Visual Studio 2010 SharePoint Developer Tools don’t provide any User Interface to specify Solution Dependencies. It can be however easily done by editing the Solution Manifest in the XML Editor.

Summary

Solution Dependencies are a new concept introduced with SharePoint 2010. Solution Dependencies allow you to easily check if all resources required by your Solution are available prior to deploying it. By specifying additional information next to the ID of the required Solution you make it easier to track and install the missing resources.

Technorati Tags: SharePoint 2010

Others found also helpful: