Monday, March 21, 2016

Feature Dependency SharePoint 2013

Feature Dependencies in SharePoint 2013 - Base Site Features

The feature that depend another feature to work correctly on the site called feature dependent.
In SharePoint 2013, all most all site template has its own dependency on other features.


In team site navigation hierarchies with managed meta data, requires publishing feature dependency.
Team site with default list and list template requires few feature dependencies.

Or, if you want to provision the list with event receiver, you may prefer to split the even receiver logic, site column and content type in to different feature. Finally, your list will group all the features to work as expected. In that case, no features will be activated with dependent features are activated first.

First site column features must be activated, the content type that relies on the column must be activate and finally the list definition and event receiver.

Go to C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\TEMPLATE\FEATURES
Open the “BaseSite” folder and “Feature example, it will be shown like this image,

So the base site feature id: B21B090C-C796-4b0f-AC0F-7EF1659C20AE has its dependencies on rounded blue bordered box.

Feature Name
Feature GUID
Local Directory Site Control

Portal Layouts

WebPart Adder groups.

Document routing resources

Record Resources

Social Site

Search WebParts

Search templates and resources

Item Form recommendations


Types of Features:

  1. cross site scoped : The feature can have it dependency of the another feature that is scoped its  high level hierarchies. Example , Publishing feature in the web (sub site) scope requires the site collection scoped Publishing Infrastructure should have been activated prior to be activated on the site level.
  2. Same site scoped : Feature can have its dependency of the other feature that is scoped on the same site scope level.

    Example, A feature that provisioning the site columns should be activated before the feature that creates the content type that relies on the already available site columns in the site and its associated form template on the site.

Rules of the Feature:

  1. Feature can be set to visible or hidden through its feature definition file (Feature.xml)
  2. Hidden feature cannot have any feature dependency.
  3. Hidden feature can activated ,deactivated,installed and uninstalled through only Power shell command,So farm admin have full control on it.
  4. Feature dependencies cannot be chained.