Understanding Feature activation dependencies 当我们激活的Feature需要依赖于另外一个Feature才能激活时,我们需要现激活被依赖的Feature

Hi All,
When you create the feature, it can also include the dependencies. Let’s say, we have one feature that is dependent on the other feature, that means when we activate one feature, it actually requires the other feature already been activated, at that time we can use this feature dependencies.
A very good example of this is TeamCollab feature which activates many other features automatically. It creates several list templates and makes it available for the site.
Let me give you a very simple example of Feature Dependencies.

<Feature
Id={GUID}
Title={title}
Description={Description}
Version={version}
Hidden={value}
Scope={value}
xmlns={namespace} />
<ActivationDependencies>
<ActivationDependency FeatureId = {dependent Feature GUID}/>
</ActivationDependencies>


That means the feature inside the ActivationDependency must be activated before the main feature gets activated.
If the main feature is A and inside ActivationDependency we write feature B, then activating Feature A first activates feature B and then activates feature A.
Note that Feature B must be installed first at specific scope.
Other very important thing to note here is you must have to define feature B (Feature that goes inside ActivationDependency) as Hidden, otherwise SharePoint will throw error saying that the dependant feature is not enabled.

本文转自:http://www.sharepointkings.com/2009/06/understanding-feature-activation.html

原文地址:https://www.cnblogs.com/qixing_gan/p/2773700.html