Feature Activation
Dependency allows to make Features dependent on each other. So if FeatureB has
activation dependency on FeatureA, then FeatureB can only be activated if
FeatureA is activated. If this is not the case it will prompt you with a
message to activate FeatureA first.
A sample Feature
element tag is given below:
<Feature Id="GUID" Title="Feature Title"
Description="Feature Description"
Version="1.0.0.0"
Scope="Site"
Hidden="false">
<ActivationDependencies>
<ActivationDependency FeatureId="GUID" />
</ActivationDependencies>
</Feature>
<Feature Id="GUID" Title="Feature Title"
Description="Feature Description"
Version="1.0.0.0"
Scope="Site"
Hidden="false">
<ActivationDependencies>
<ActivationDependency FeatureId="GUID" />
</ActivationDependencies>
</Feature>
If the dependent
feature is hidden (to make a Feature hidden, set the Feature element's
"Hidden" attribute to "False"), it will be activated automatically
when the dependee feature is activated. For example if FeatureB has
activation dependency on FeatureA and FeatureA is hidden, then FeatureA will be
activated automatically when FeatureB is activated. Otherwise we need to
activate the FeatureA manually before activating the FeatureB.
Following are some
important points which needs to be considered when dealing with feature
activation dependencies:
- A visible Feature can have dependency on hidden Feature, but a hidden Feature cannot have dependency on visible Feature.
- It doesn't support circular dependencies (FeatureA depends on FeatureB and FeatureB depends on FeatureA).
- It has limited support for dependency chains. For example, WSS 3.0/MOSS 2007 supports more than one level in activation dependencies if a visible Feature depends on a second visible Feature that in turn depends on a hidden Feature. But it does not support more than one level in activation dependencies if the last Feature is visible—that is if a visible Feature depends on a second visible Feature that in turn depends on a third visible Feature.>
- If the dependent Feature is not activated, activation of the dependee Feature will fail. But if dependent Feature is hidden, then it will be automatically activated when the dependee Feature is activated.
- Cross-scope activation dependencies are not supported if following conditions are satisfied:
- If the dependent Feature is at a more restrictive scope. For example, a site collection scoped Feature cannot have an activation dependency on a web site scoped Feature.
- If the dependent Feature is not visible. For example, a web site scoped feature cannot be dependent on a site collection scoped Feature that is not visible in the user interface.
No comments:
Post a Comment