Do you turn off auto activation on farm and web application scope features?

Last updated by Brook Jeynes [SSW] 10 months ago.See history

Each SharePoint packages contains features that can be targetted at various scopes. You need to pay special attention when you are targetting the Web Application scope.

The feature XML looks like this.

<Feature 
    Id="{GUID}"
    Title="WebApplicationConfiguration" 
    Scope="WebApplication" 
    Version="1.0.0.0" 
    Hidden="FALSE" 
    DefaultResourceFile="core" 
    xmlns="http://schemas.microsoft.com/sharepoint/" 
>
  <ElementManifests />
</Feature>

But there is a problem...

The problem with this web application feature is that it will activate by default on all new Web Applications created on that farm, regardless of what the web application or root site template is.

The best practice is to make sure you use the additional attribute ActivateOnDefault and set it to False. Then SharePoint administrators can choose to activate the feature after a new web application is created.

<Feature 
    Id="{GUID}" 
    Title="WebApplicationConfiguration" 
    Scope="WebApplication" 
    Version="1.0.0.0" 
    Hidden="FALSE" 
    DefaultResourceFile="core" 
    xmlns="http://schemas.microsoft.com/sharepoint/"
    ActivateOnDefault="False"
>
  <ElementManifests />
</Feature>
We open source. Powered by GitHub