Wednesday, November 24, 2010

SharePoint 2010 Publishing feature GUID - Activation Dependency

This Publishing feature Activation Dependency within the elements.xml ensures that your custom feature gets activated only when Publishing feature is enabled on your respective site collection. Copy and paste the code below in your custom feature project elements.xml file -

<ActivationDependencies>
    <ActivationDependency FeatureTitle="Publishing Infrastructure" FeatureDescription="Publishing Infrastructure need to be activated prior to deploying the Custom PageLayouts, Site Content Types and Site Columns feature." FeatureId="f6924d36-2fa8-4f0b-b16d-06b7250180fa" />
  </ActivationDependencies>

If the scope of your feature is Web, then you can even ensure whether Publishing site feature has been activated on your subsite as well:

<ActivationDependency FeatureTitle="SharePoint Server Publishing" FeatureDescription="Option to create Custom Page Layouts will not be visible, unless you activate SharePoint Server Publishing feature at the web level." FeatureId="94c94ca6-b32f-4da9-a9e3-1f3d343d7ecb" />