2

I’m trying to add my first web part to the working environment and have some problems with the deployment. I clicked on my development machine release and copy the *.wsp file from the "bin/release" folder to the working environment SharePoint desktop.

I deployed the *.wsp file with following command:

Add-SPSolution C:\User\admin\Desktop\ProjectName.wsp
Install-SPSolution -Identity ProjectName.wsp -WebApplication http://sharepointportal –GACDeployment

from the working environment SharePoint. Everything works fine.

After that I activated the feature in SharePoint and tried to add it to a page. Here occurs the error. If I try to add the web part, SharePoint tells me, that the web part element was deleted in the catalogue. If I went to "All Web Parts", the web part is listed, but if I click on it, SharePoint tells me that the web part is missing, what went wrong?

In C:\windows\assembly, the assembly exists and also the SafeControl entry in web.config exist.

<SafeControl Assembly="ProjectName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=314328d2d4e8850d" Namespace="ProjectName.Dictionary" TypeName="*" Safe="True" SafeAgainstScript="False" />

What I did wrong?

Additional informations

I'm honestly a little bit confused, because I have renamed the Feature from, I think, Feature1 to Dictionary, maybe there is the problem.

Yes, the web part class is public:

public class Dictionary : Microsoft.SharePoint.WebPartPages.WebPart
{...}

Here a small dump from my project folder:

Project Folder

The Dictionary.feature contains:

<Feature xmlns="http://schemas.microsoft.com/sharepoint/" Title="Titel" Id="..." Scope="Site">
  <ElementManifests>
    <ElementFile Location="Dictionary\Dictionary.webpart" />
    <ElementManifest Location="Dictionary\Elements.xml" />
  </ElementManifests>
</Feature>

The Package.package contains:

 <Assemblies>
    <Assembly Location="ProjectName.dll" DeploymentTarget="GlobalAssemblyCache">
      <SafeControls>
        <SafeControl Assembly="ProjectName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=...." Namespace="ProjectName.Dictionary" TypeName="*" />
      </SafeControls>
    </Assembly>
  </Assemblies>
  <TemplateFiles>
    <TemplateFile Location="CONTROLTEMPLATES\ProjectName\Dictionary\DictionaryUserControl.ascx" />
    <TemplateFile Location="Layouts\ProjectName\Button.css" />
    <TemplateFile Location="Layouts\ProjectName\Dialog.aspx" />
    <TemplateFile Location="Layouts\ProjectName\javascripts\jquery-1.6.4.min.js" />
    <TemplateFile Location="Layouts\ProjectName\Site.css" />
  </TemplateFiles>
  <FeatureManifests>
    <FeatureManifest Location="ProjectName_Dictionary\Feature.xml" />
  </FeatureManifests>

Does that help further?

Greetz

4
  • Does your project include the elements.xml, the classfile, and the webpart file for the webpart? Nov 14, 2011 at 16:08
  • Did you mark the webpart class as Public?
    – Dave Wise
    Nov 14, 2011 at 16:54
  • See my Additional informations. Is it really enough just to deploy the *.wsp? Thanks. Greetz
    – user5167
    Nov 14, 2011 at 17:39
  • Btw, what is the different between the Release "/bin/release" and the package (pkg, pkgobj, obj). Greetz
    – user5167
    Nov 14, 2011 at 17:55

2 Answers 2

1

Now I got it! The problem occurs after I updated the web part. I updated the wep part with:

Update-SPSolution -Identity ProjectName.wsp -LiteralPath C:\test\ ProjectName.wsp –GACDeployment

and after that I use:

Enable-SPFeature FeatureName  -Url http://... 

to update the web part. Now share point doesn’t find the web part and I get the error from above.

I fixed it with the following steps:

1. Uninstall-SPSolution –Identity ProjectName.wsp –WebApplication http://...
2. Check if the Feature is deactivated, removed.
3. Delete the web part from the web part gallery.
4. Remove-SPSolution –Identity ProjectName.wsp

Did I something wrong with the update? Everytime I update the web part, the error occur.

Edit:

If I deactivate the web part in the global site collection, update it with Update-SPSolution and activate it, everything works fine!

Thanks everyone. Greetz

0

Make sure you have the same Namespace for webpart and safecontrol entry. Also it make sense to double check the assembly name, public token and version.

Also check the .webpart file and elements - to make sure you have the same values everywhere

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.