10

I have created several custom web parts in a Visual Studio solution which deploys to my development environment site perfectly directly through Visual Studio. However, I also want to be able to deploy this solution to my testing/production environment which means using Powershell commands to accomplish the same result as a deploy through Visual Studio. Every guide I've found uses the same commands that I am using which seems like it works but my web parts never show up in the web part gallery. They do show up in the web part gallery through the Visual Studio deploy method so Visual Studio must be doing something else to provision them there. The steps I'm using are as follows:

-Publish the Visual Studio solution and copy/paste the resulting .wsp file to a folder in my other site's machine at C:\Deploy\

-In SharePoint Management Shell on the machine I'm deploying to:

  1. Add-SPSolution -LiteralPath C:\Deploy\Announcements.wsp
  2. Install-SPSolution -Identity Announcements.wsp -AllWebApplications -GACDeployment
  3. Install-SPFeature -Path Announcements_Feature1 -Force
  4. Enable-SPFeature -Identity Announcements_Feature1 -Url "site"

These commands all go through without error but the web parts don't show up in the web part gallery and I can't add them to my pages. I have tried uninstalling/removing the solution and add/installing again. I've made sure the feature scope is at the Site level. The -GACDeployment in the install command should register the solution as safe. The web parts are in the feature...I feel like I've tried everything and still nothing works.

Edit: I've also tried this approach on my development environment machine which is the same machine Visual Studio deploys to perfectly and still no luck.

  • Have you figured out the root cause for the features not appearing in the Site Features page? I'm having the same problem... – Charles Dec 3 '14 at 21:22
  • Nope, similar thing happens when I push CSS/JS in a .wsp. I have to delete the current files for the new ones to pull in. Seems Microsoft just botched this process since they clearly didn't want anyone customizing their stuff. – Fenoec Dec 4 '14 at 17:22
15

You need to populate the gallery if web part is not appearing in the web part gallery. For that go to site setting(I use 2013) site gallery, click on

web parts

link

enter image description here

There clicking on new documents, you will get all the web parts installed. Check the box along the web part name and click on populate button on the top.

enter image description here

That should work, I hope.

  • That's a step in the right direction! I can now see it in the web part gallery and when I go to add a web part to a page but I've still got a problem. When I try to add it it seems to be looking for it in my development environment site. Do you know if there is somewhere I need to change the URL mapping for the web part? – Fenoec Oct 9 '13 at 18:27
  • 1
    I haven't faced such issue yet. Review the ULS logs for details – Biju Joseph - MCSD Oct 10 '13 at 1:24
  • This works - but its fixing the Symptom not the problem. The problem is that this should happen as part of activation and you shouldn't have to do this manually. – Ryan Apr 14 '14 at 14:39
2

I had a similar issue. Somehow the properties of the files in my web part got erased. I set the properties again and when I deployed the web part was once again in the web part gallery. These properties have to be set:

  1. The web parts' element.xml deployment type should be set to ElementManifest
  2. The ascx-file build type should be content, deployment type NoDeployment and Custom Tool should be SharePointWebPartCodeGenerator
  3. The ascx.cs-file build type should be compile, deployment type NoDeployment
  4. The .webpart-file itself should have build type set to None and deployment type should be set to ElementFile

Obviously your web part should also be added to a feature, the feature should be part of the solution package and the feature should be activated on the site where you want to be able to use the web part.

protected by Community Nov 29 '16 at 13:25

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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