3

I wrote a visual webpart in Visual Studio 2010 that works fine in the SharePoint instance on that machine when VS deploys it. It appears in the gallery and I can add the webpart to a page successfully.

enter image description here

I then packaged that webpart, copied the WSP to another SharePoint server, ran Add-SPSolution, and deployed the solution from Central Administration. However, the webpart does not appear in the gallery. The gallery doesn't even have a Custom folder!

enter image description here

I also tried using the "Upload a Web Part" option at the bottom but that didn't work. I can pick the webpart and click Upload, but it just displays the gallery again without my custom webpart.

I don't even know where to begin troubleshooting. Any ideas?

  • did you activate the feature on the site? – David Lozzi Apr 26 '13 at 14:50
  • I don't see where to do that. It's not listed in features at the site level or in central admin. Also, I don't see it in my dev environment feature lists. – longneck Apr 26 '13 at 14:53
  • Your VS project should have a Feature in it? Check it out, and look at the scope field (Web is a Site Feature, Site is a Site Collection Feature). Make sure the web part is in the feature. Also, look inside the Package, make sure it contains your web part. – David Lozzi Apr 26 '13 at 18:16
  • @DavidLozzi: I am facing the same problem. Web part is also added in the feature. My package also contains the web part. I have checked the feature for this web part and it is already activated but i do not find web part in web part gallery. could you please let me know if there is settings that i need to check? Thanks in advance. – Rohit Waghela Jun 15 '16 at 11:16
3

Okay let's go over everything to do with WebParts see what you are missing out

1) Types:

.DWP is version 2 webparts .webpart is version 3 webparts

Reading the dwp/webpart file will tell you the version of the webpart even if the extension is wrong xmlns="http://schemas.microsoft.com/WebPart/v2"

Once you have determined this then you need to enter your title and description in this file. These are two different schemas and are based from different types of webpart (System or SharePoint)

2) In your elements.xml make sure the group and title are set:

<File Path="OrganisationActivityWebPart\OrganisationActivityWebPart.dwp" Url="MyOrganisation.Internal_OrganisationActivityWebPart.dwp" Type="GhostableInLibrary">
  <Property Name="Group" Value="ACME" />
  <Property Name="Title" Value="ACME Organisation Activity" />
</File>

3) Add the webpart into a "Site" scoped feature

This is so that it will create a spdata entry to add your webpart as a safe control into the web.config.

4) Deploy your solution

5) Activate the "Site Collection Feature" that you created for the webpart on the target site collection

6) Finally go to the page and edit and add your webpart

  • My problem appears to be with step 5. The feature does not show up in the list to activate. However, I noticed in the build output that VS activated a feature that looks like ProjectName_FeatureName so I used PowerShell Enable-SPFeature for that feature and now I see it in the Gallery. Does that give you an idea what the problem might be? – longneck Apr 26 '13 at 15:55
  • 1
    find out scope of your feature, it could be in "Site Features" not "Site Collection Features" – Muhammad Raja Apr 26 '13 at 16:14
  • Yes check the scope of the feature in visual studio, apart from that check the feature name, you might of missed it on the list (I've done this where I have forgotten to name a feature and it has not been where I expected it. ie School Boy Error!) – Hugh Wood Apr 29 '13 at 8:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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