What is Feature Dependency?

Definition: In SharePoint, Feature is used to group SharePoint project items for easy deployment.

Feature can be activated and de-activated based on requirement and accordingly project items added in the feature, will be activated and de-activated from the scope it is deployed.

Create a Feature:

  • Go to Visual Studio
  • Create a SharePoint empty project >> Select – Deploy as a farm solution
  • Open the Feature file and add below feature properties.
  • Title: Enter title of the feature
  • Description: Enter the text which describes the feature
  • Scope: Specify the scope of the feature
  • Items in the Solution: Here you can find all the items that can be added in feature
  • Items in the Feature: Here you can find all the items that you are adding as part of feature

Below are the scopes of a Feature. A Feature can be deployed at below mentioned levels.

  • Farm Level:
  • Web Application Level:
  • Site Collection Level:
  • Site Level:

Definition: There may be situation when your feature is dependent on any other feature for functionality or data. In this situation, you can mark that other feature as dependency for your feature.

You can add other feature in your solution as dependency so that before activating your feature you can make sure that other feature is activated.

Add Dependency:

  • Open Project >> Open Feature in design mode
  • Expand the Feature Activation Dependencies node. Click on Add button
  • In the Add Feature Activation Dependencies dialog box, choose the Add a dependency on features in the solution option, choose the title of the feature that you want to add as a dependency, and then choose the Add button.
  • Add more than one feature by choosing multiple titles while pressing Ctrl

Add Custom Dependency:

  • Open Project >> Open Feature in design mode
  • Expand the Feature Activation Dependencies node. Click on Add button.
  • In the Add Feature Activation Dependencies dialog box, choose the Add a custom dependency option,
  • In Feature ID text box, enter the GUID of the feature that you want to mark as dependency.
© 2019 Code SharePoint