Deployed Web Part not showing up in 'Web Part Gallery: New Web Parts'

17,005

Solution 1

wow... turns out that all I was missing was a 'public' declaration on my class!?!

I feel like an idiot. But also, I did have to manually delete it to get it recognized. Thanks everyone!

Solution 2

Check that the .webpart file deployed to the wpcatalog folder of your web site. Depending on what directory was specified when provisioning the web application, you should find it in a location similar to this:

c:\Inetpub\wwwroot\wss\VirtualDirectories\80\wpcatalog

Solution 3

I've had the same problem with a Web Part I've been working on but in my case I simply forgot to add a Web Part to "Items in the Feature" box. To do this:

  1. In Solution Explorer unfold the subtree of your Feature.
  2. Double-click the item ending with .feature.
  3. You should see a new tab with Feature's title, description and scope. Below them there are two boxes with buttons in between. From the left box select your Web Part and press the > button (marked on image) to add it to the Feature.

NOTE: You can also do this by pressing the Manifest button on the bottom and editing the Manifest file manually, if you know what you're doing.

Adding Web Part to Feature

This really may help other SharePoint starters.

Solution 4

I had sometime same behaviour. Finally we wrote a cmd-tool, which run "stsadm - o addsolution" and then add to web part gallery all xml files for web parts.

There is source ( little-bit edited ):

string cmd_StsAdm = @"C:\Program files\Common files\Microsoft Shared\web server extensions\12\BIN\stsadm.exe";
string url_Site = "http://localhost";
string url_Web = "http://localhost";
if ( string.IsNullOrEmpty( url_Web ) ) { url_Web = url_Web; }

Console.WriteLine( "Deleting sharepoint solution" );
string args_DeleteSolution = string.Format( "-o deletesolution -name \"{0}\" -override", startInfo.fileNameWsp );
ShellWait( cmd_StsAdm, args_DeleteSolution );

string filePathWsp = "**** path to wsp file ****";
Console.WriteLine( "Adding sharepoint solution" );
string args_AddSolution = string.Format( "-o addsolution -filename \"{0}\"", filePathWsp );
ShellWait( cmd_StsAdm, args_AddSolution );

Console.WriteLine( "Deploy sharepoint solution" );
string args_DeploySolution = "-o deploysolution -name \"{0}\" -local -allowGacDeployment -url \"{1}\" -force";
args_DeploySolution = string.Format( args_DeploySolution, startInfo.fileNameWsp, url_Web );
ShellWait( cmd_StsAdm, args_DeploySolution );

int counter = 0;
foreach ( CWebPartVytvoreniInfo wpRslt in solutionInfo.WebParts ) {
    counter++;
    string msg = string.Format( "Aktivace web part {0} - {1} z {2}", wpRslt.Info.Nazev, counter, solutionInfo.WebParts.Count );
    Console.WriteLine( msg );
    string args_ActivateFeature = "-o activatefeature -id {0} -url {1}";
    args_ActivateFeature = string.Format( args_ActivateFeature, wpRslt.Info.ID, url_Site );
    ShellWait( cmd_StsAdm, args_ActivateFeature );
}

Console.WriteLine( "Connecting to sharepoint site" );
using ( Microsoft.SharePoint.SPSite site = new Microsoft.SharePoint.SPSite( url_Site ) ) {
    Microsoft.SharePoint.SPList ctg_WebParts = site.GetCatalog( Microsoft.SharePoint.SPListTemplateType.WebPartCatalog );

    counter = 0;
    foreach ( WebPartInfo wpInfo in solutionInfo.WebParts ) {
        counter++;
        string dirPath = System.IO.Path.Combine( wpInfo.DirectoryPath );
        string fileName = wpRslt.Info.Nazev + ".webpart";
        string filePath = System.IO.Path.Combine( dirPath, fileName );

        string msg = string.Format( "Uploading file '{0}' - {1} z {2}", fileName, counter, solutionInfo.WebParts.Count );
        Console.WriteLine( msg );
        using ( System.IO.FileStream fstrm = OtevritSoubor( filePath ) ) {
            ctg_WebParts.RootFolder.Files.Add( fileName, fstrm, true );
        }
    }
}

Solution 5

I have found that if I deployed a webpart that was borken previously I have had to manually delete it after removing the solution, before re-adding the solution

Share:
17,005
user1477701
Author by

user1477701

I like to code and lift weights... I am a full-time full-stack Software Engineer. Received my BS in Computer Science, MBA, MS in Computer Science, and MS in Software Engineering. I spent a few years in the military then working as a contractor overseas which eventually brought me back to the states where I am currently contracting.

Updated on June 05, 2022

Comments

  • user1477701
    user1477701 almost 2 years

    I took a wsp file, and did my stsadm -o addsolution like usual. Then I went into central administration->solution management and it showed up just fine. Then I deployed the web part, no problems so far.

    The problem is when I go to add it to the webpart gallery (Web Part Gallery: New Web Parts) usually the web part is in the list, I check the box next to it and click populate gallery but it is not showing up in the list? Could I be missing something in my manifest.xml to cause this? I just wrote and deployed another web part this exact same way and it went fine. Also, I wrote a dummy webpart that does nothing but print "working" and tried it with that getting the same results.

    Any ideas?

  • Luis Molina
    Luis Molina about 9 years
    Thanks, in my case the feature file comes from a started project and the webparts I added doesn't were included in the features, so I added like you said and it worked like a charm.