Click here to Skip to main content
15,889,862 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I've been working on a Sharepoint 2010 Web Part project that worked fine yesterday, but does not work this morning (with no changes).

When I open the page that houses the Web Part in a browser, it now displays:

"Web Part Error: A Web Part or Web Form Control on this Page cannot be displayed or imported. The type PostTravelWizard.PostTravelWizardWebPart.PostTravelWizardWebPart, PostTravelWizard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b94745c5a5a3d602 could not be found or it is not registered as safe."

Sometimes in the past when this has happened, these kind of problems were fixed when I rebuilt and deployed the project. Howevr, this time When I opened the project in VS 2010, rebuilt, and attempted to deploy, it tells me:

"Error occurred in deployment step 'Add Solution': This solution contains no resources scoped for a Web application and cannot be deployed to a particular Web application."

This blog post says that I need to open the package's manifest file and edit it by adding dummy data such as:

<Solution xmlns="http://schemas.microsoft.com/sharepoint/"> 
 <Assemblies>   
  <Assembly Location="SharePointProject1.dll" DeploymentTarget="GlobalAssemblyCache">     
   <SafeControls>       
   <SafeControl Assembly="SharePointProject1,Version=1.0.0.0, Culture=neutral, PublicKeyToken=****************" Namespace="SharePointProject1" TypeName="*" />     
   </SafeControls>   
  </Assembly> 
 </Assemblies>
</Solution>


The data I currently have there is:

0) "Preview of Packaged Manifest":

<Solution xmlns="http://schemas.microsoft.com/sharepoint/" SolutionId="5f397aa5-be1f-4eb1-a673-314b6da2c706" SharePointProductVersion="14.0">
  <Assemblies>
    <Assembly Location="PostTravelWizard.dll" DeploymentTarget="GlobalAssemblyCache">
      <SafeControls>
        <SafeControl Assembly="PostTravelWizard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b94745c5a5a3d602" Namespace="PostTravelWizard.PostTravelWizardWebPart" TypeName="*" />
      </SafeControls>
    </Assembly>
  </Assemblies>
  <TemplateFiles>
    <TemplateFile Location="CONTROLTEMPLATES\PostTravelWizard\PostTravelWizardWebPart\PostTravelWizardWebPartUserControl.ascx" />
  </TemplateFiles>
  <FeatureManifests>
    <FeatureManifest Location="PostTravelWizard_Feature1\Feature.xml" />
  </FeatureManifests>
</Solution>


1) In the "Edit Options" area:

<?xml version="1.0" encoding="utf-8"?>
<Solution xmlns="http://schemas.microsoft.com/sharepoint/">
</Solution>


I don't know just what I should edit there - what I see in "Preview of Packaged Manifest" seems pretty much the same as what he is saying to add (with the obvious difference in project names).

Rhetorically I wonder why Sharepoint is so fragile, but my real, direct question is: Why is this happening, and what must I do to get my Web Part working again?
Posted
Updated 16-Sep-15 7:29am
v3

1 solution

I was able to solve the problem via what I found at this post.

(change project property "Assembly Deployment" from "GAC" to "WebApplication")
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900