Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a SP2010 wsp that contains multiple features all are scoped "web" all was working fine. But suddenly one of the feature stopped activating by default on deployment though all other features are activated. I checked for the "Activate On Default" property which is set to true. But it seems to have no effect on activation.I can go to features list in my site and activate the feature manually and there is no error and feature performs what its intended to.

Tried to even debug the feature receiver code (using VSSHost) but that too doesn't work.

Any help will be appreciated.

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

The ActivateOnDefault attribute does not apply to site collection (Site) or Web site (Web) scoped Features.

It only determines if Farm or WebApplication scoped features are activated by default when deploying. And in case of WebApplication scoped when a new Web Application is created.

This has nothing to do with the automatic activation which Visual Studio performs as part of its deployment.

Is your feature deployed, but just not activated? If not hidden it should show up in Site features below Site Settings. If not here then look in the Package Designer to verify that the feature is included in the Package.

If it's deployed, but not being activated, then try to activate it through UI or PowerShell to see if there is any errors. As you mention you have a feature receiver it might be best to use a newly opened "SharePoint 2010 Management Shell", attach debugger and run Enable-SPFeature

share|improve this answer
    
Yes my feature gets deployed and comes up in the feature list but not auto activated as earlier.I can manually activate it without any errors. –  V.B Jul 30 '12 at 11:20
    
Have you tried to manually activate it through PowerShell? A common mistake is to use SPContext.Current in the FeatureReceiver, which only works when activating though the UI –  Per Jakobsen Jul 30 '12 at 11:24
    
Yea I tried to activate using enable feature but it complains about scope of the feature that this feature is "Site" scoped and it complains about the URL as it has sub site as a part of it. I am aware of NOT using SPContext in feature receiver as it will always be null. Thing is it used to activate automatically earlier but something is there that I am not able to identify. –  V.B Jul 30 '12 at 11:33
    
Have you checked the scope of the Feature? If the scope is Site and the SiteUrl in VS is to a Subsite it wont automatically activate it. If it worked before, then it may have become broken, by changed Scope or url being changed to not being RootWeb. –  Per Jakobsen Jul 30 '12 at 11:42
    
I resolved the problem. It lied with VS environment.Another copy of solution worked fine. –  V.B Jul 31 '12 at 10:57
add comment

1) In Solution Explorer, expand Features.

2) Double-click the Feature item.

or

2) Right-click the Feature item, and then click View Designer.

3) Click Manifest.

Check the value of the ActivateOnDefault attribute.

share|improve this answer
    
its already set to true. –  V.B Jul 30 '12 at 10:42
    
Have you tried programmatically activating the feature? social.technet.microsoft.com/Forums/en/… –  Vardhaman Deshpande Jul 30 '12 at 10:56
    
No, But I want it done through VS 2010. –  V.B Jul 30 '12 at 11:01
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.