2

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 2

0

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.

http://social.technet.microsoft.com/Forums/office/en-US/9812889d-954a-43ef-9377-6561e91f3bbf/programmatically-how-to-activate-the-publishing-infrastructure-feature-of-the-site-collection?forum=sharepointdevelopmentprevious

How to enable site collection feature by default when deploying a visual webpart from visual studio?

Feature not activated by default

0

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);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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