0
votes

I've created and "deployed" my latest Web Part (Visual Studio grins from ear-to-ear, and tells me, "Deploy succeeded").

But when I go to our Sharepoint site, and my "sandbox" page, and Edit it, I do not see the WebPart. As the Elements file shows, it should be available from the "Financial Affairs Forms" category:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/" >
  <Module Name="PostTravelExpenseWebPart" List="113" Url="_catalogs/wp">
      <File Path="PostTravelExpenseWebPart\PostTravelExpenseWebPart.webpart" Url="PostTravelExpenseWebPart.webpart" Type="GhostableInLibrary" >
      <Property Name="Group" Value="Financial Affairs Forms" />
    </File>
</Module>
</Elements>

However, that category is devoid of the "PostTravelExpenseWebPart" I expect (or at least hope) to see there:

enter image description here

What might I be omitting?

UPDATE

I even went so far as to, while in Edit mode on the Web Page, expand the "Upload a Web Part" section below "Categories" after selecting one of the "Add a Web Part" links. I didn't know exactly what to upload (when browsing for a file, the File Dialog doesn't clue you in on what file extension it expects), so I, on a flayer, tried uploading PostTravelExpense.ascx

It accepted it without balking, but I do not see it anywhere (nor do I know why just the *.ascx file would be enough, but again, which file does it expect?) It doesn't allow me to upload the entire project folder.

UPDATE 2

In response to the comment below, note that The project's Assembly Deployment Target" property is set to GlobalAssembyCache

1
if there is section custom webparts in categories, you can check that part. I always deploy web parts by command and also you should deploy it to gac if it is neccessary. And lastly did u try to add webpart by using sharepoint designerbrtb
Yes, I checked all the categories, and it's showing up in none of them; with previous web parts, all I had to do was deploy it from Visual Studio, then go to my "sandbox" page which is part of the Sharepoint Site, edit it, and add the WebPart to the page. I don't know what you mean by "by command" or how/why I would deploy it to GAC. Neither do I know how or why I wold add the web part via Sharepoint Designer.B. Clay Shannon

1 Answers

0
votes

By comparing a working project with this one, I was finally able to get it to deploy without the "A Web Part or Web Form Control on this Page cannot be displayed or imported. The type could not be found or it is not registered as safe." add-time error msg.

What I had to do was check every place in the working project where the primary namespace was referenced, and make sure that the corresponding namespace in the previously-unworking project was referenced in those same places

This required not only changing some of the files visible in Visual Studio's Solution Explorer treeview, but also two that I only was able to load into the editor by searching for strings they contained, specifically:

The ***.spdata** file, which I loaded up by searching for "SafeControl"
**Assembly.Info**, which I loaded up by searching for "AssemblyTitle"

That sure was a lot of hand-wringing and head-banging and pitiful whin[g]ing for something that one would think would automatically be taken care of by the IDE - when a namespace changes, make all the necessary changes, or at least notify the coder and offer to do so! Or, barring that, at the very least give him a better clue than "A Web Part or Web Form Control on this Page cannot be displayed or imported. The type could not be found or it is not registered as safe." when the WebPart to be plopped onto the page proves unploppable.