0

I am new to sharepoint and was asked a question and I didn't know the answer of that, can someone please help. Please provide the reason for the solution.

Can we deploy Visual webpart with feature which has webscope, how and why/why not

0

1 Answer 1

-1

Web parts are deployed to the web part gallery that lives in the root web of a site collection. You might be able to get away with a web scope feature if that feature is only ever activated on the root web. But that will make it available to all subsites anyway.

Best practice is to make web parts available in a Site-scoped feature, and you deviate from that at your own peril.

2
  • Despite visual studio letting you add Web Parts to a Web scoped feature, when you attempt to deploy it gives you the message: error SPT4: The Project Item "WebPartTest" cannot be deployed through a Feature with Web scope.
    – Choggo
    Commented Oct 18, 2014 at 16:59
  • Downvote because it's exactly the copy of answer from duplicate marked above. And being it's a best practice, more it is an obligation rather than a choice. Commented Oct 18, 2014 at 19:01

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