Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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

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

2 Answers 2

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

share|improve this answer
up vote 1 down vote accepted

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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