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 want to create and deploy a web part as web-scoped feature.

In Visual Studio 2010, when I make the feature scope=web, I cannot add the webpart to that feature as I am able to do when scope=site.

share|improve this question
    
What is the error you are getting? And what are you doing when you get the error. –  Laurie Jun 14 '11 at 4:45
    
i am not getting any error. In visual studio 2010,i am creating webpart then i am creating new feature : scope =web When i set the scope of feature as web , i am not able to deploy my webpart . This we could do in MOSS 2007 . –  Monica Jagani Jun 14 '11 at 4:59
    
If you do not get an error, what do you mean by "not able to deploy my webpart"? Do you add & deploy the wsp and the feature does not show up in Site Actions > Site Settings > Manage site features? –  Laurie Jun 14 '11 at 5:11

1 Answer 1

up vote 10 down vote accepted

You can't deploy a Web Part at the Scope = Web level. Web Parts must be deployed at the Site level since the .dwp or .webpart file needs to be deployed to the Web Part gallery, which is at the Site Collection level.

share|improve this answer
    
ok thanks cris. –  Monica Jagani Jun 14 '11 at 6:00
2  
Good point. Although, I believe technically you can create a web-scoped feature and set it as RootWebOnly="TRUE". It could only be activated at the root site where the web part gallery resides. But that wouldn't really achieve anything, since it would be usable by all subsites. It makes the most sense to just make it site-scoped. –  Laurie Jun 14 '11 at 6:18
    
@Laurie : thanks for the complete information. –  Monica Jagani Jun 14 '11 at 6:52
    
The VS2010 Feature Designer is built to filter out elements that are appropriate to various scopes. Web Parts are filtered to the Site scope, so despite the fact that it is technically possible, you would have to hand-tool the Feature.XML to be able to do it. Content Types and Site Columns are better examples of an element that the Feature Designer allows to be scoped to either Site or Web, since it is practical that you may wish to deploy these for an entire site collection, or only at a specific sub-site. –  Chris Beckett Jun 14 '11 at 15:25
    
I would like to know where does the webpart get stored when we deploy it via wsp? Is it in the LAYOUTS folder or content db?\ –  variable Apr 8 at 6:35

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.