Sunday, June 14, 2009

Web Application scoped Feature get auto activated

I had a timer job running with scope of Web Application and I faced an issue where I wanted to use it for only one Web Application , but when ever some one create a new Web Application , this feature was getting activated automatically.

I suspected of some auto activate property because I used AutoActivateInCentralAdmin before, and that's what it was. Feature definition support a property ActivateOnDefault , unfortunately its default value is TRUE. I will say big mistake from Microsoft.

As per my fellow friend Sahil this property has no effect on feature scoped at Web and Site level , it only works for Farm and Web Application level.

Setting the ActivateOnDefault to FALSE solved the issue.


<?xml version="1.0" encoding="utf-8"?>  
<Feature Id="GUID" Title="Web App Timer" Scope="WebApplication" Version="" Hidden="FALSE" DefaultResourceFile="core" ActivateOnDefault="False"> xmlns=""
<ElementManifest Location="elements.xml" />
Follow me on Twitter