I want to auto active feature when deploy solution from central admin site. it is auto activated successfully when I deploy solution from visual studio. How can I auto active feature when deploy solution from central admin site ? My feature is in Site Scope.
2 Answers
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.
You need to write custom code to programmatically activate the feature.
How to enable site collection feature by default when deploying a visual webpart from visual studio?
Visual Studio activates the Feature while Deploying.
That isn't happening anymore the way you deploy it.
The easiest way would be to create a Feature Event Receiver hooking to FeatureInstalled.
Use roughly the following line in there:
SPWeb web = properties.Feature.parent as SPWeb;
web.Site.Features.Add(YOUR-FEATURE-GUID);