Caution: Web Application Scoped Features are Activated for All Web Applications by Default
Issue
Each time upon deployment of a package through PowerShell scripts, the web application scoped feature was always automatically activated in ALL web apps. The destination web application specified by -URL in Enable-SPFeature is no use.
Very weird: even though I only deployed the containing
solution but no any contained features were activated, this feature was still
got re-activated in all web apps.
The Article Saving Life
When creating SharePoint features in Visual Studio 2010, one of the settings that defaults to True is “Activate on Default”.
There is a lot of confusion as to what this setting actually does:
- It ONLY applies to features scoped at Farm and Web Application levels. You can still modify it for other features, but it doesn’t do anything.
- Any feature (Farm or WebApplication) with that setting set to True will automatically activate when you deploy the WSP solution, no matter which way you deploy it (Install-SPSolution, stsasm.exe, Central Administration)
The feature property ActivateOnDefault can be set to TRUE or FALSE. It has no impact on web/site scoped features but does have one on WebApplication/Farm scoped features.
When set to FALSE, those features are not automatically activated upon solution deployment but they are automatically deactivated upon solution retraction!
I don’t really understand the added value of that property since for me, it should have a consistent behavior. If you choose not to have them activated automatically, they should not be deactivated automatically…
Comments
Post a Comment