How can I limit feature visibility in SharePoint 2010?
I have a SharePoint 2010 (farm) solution that contains exactly feature:
The feature is site-scoped. The feature's visibility is set to "true". The assembly deployment target is set to "Web Application". The feature contains one webpart.After adding this solution to the solution store I can deploy the solution to a specific web application. However, after deploying the solution to exactly ONE web app, the feature is actually visible on ALL site collections! I would assume that the feature should only be visible in site collections hosted by that ONE web app?. Trying to activate the feature and add the webpart to a page will (expectedly) fail in all site collections of other web apps (the assemlby cannot be loaded).
Is that a SP2010 bug? Is there a workaround? I just want to limit the visibility 开发者_如何学Goof a feature to specific site collections...
Please help! Thanks
Jan, Are all your web apps running on the same WFE server? If you have multiple WFEs, you can do this:
- Deploy feature to web app A in WFE A.
- You should see the feature in the Site Collection Features of web app A.
- Now, go to a web app B in WFE B. When you look at the Site Collection Features in web app B, your feature shouldn't be there.
If your web apps are running on the same server, then they are using the same 14-Hive/TEMPLATES/FEATURES folder. Once you deploy the feature to just one web app on that server, the features-folder is sitting in that server's TEMPLATES/FEATURES folder, which will make the feature visible on the Site Collection Features of all apps in that server.
If you have multiple apps running on the same WFE and if it still your requirement to limit the visiblity of the feature, you may have to look into sandboxed solutions.
Another possiblity is you make the feature hidden (visiblity off--it will never be shown on any Site Collection Features) and just have the SP administrators do command-line/cmdlet deployment of your feature for that one web application.
-Gabe
精彩评论