七星揽月

Efforts To Make The Best Of Their……
一口吃不出一个胖子,但胖子却是一口一口吃出来的,只要能每天坚持下来,我相信,一定会有收获的
每天进步一点点
  博客园  :: 首页  :: 新随笔  :: 联系 :: 管理

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