为什么我的 Sharepoint WebPart 已部署(名义上),但仍无法添加到 page/form?

Why does my Sharepoint WebPart deploy (nominally), but is still not available for adding to a page/form?

我已经创建并 "deployed" 我最新的 Web 部件(Visual Studio 笑得合不拢嘴,然后告诉我,"Deploy succeeded")。

但是当我访问我们的 Sharepoint 站点和我的 "sandbox" 页面并对其进行编辑时,我没有看到 WebPart。如 Elements 文件所示,它 应该 可从 "Financial Affairs Forms" 类别中获得:

<?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>

但是,该类别没有 "PostTravelExpenseWebPart" 我希望(或至少希望)看到的内容:

我可能遗漏了什么?

更新

我什至做到了,在网页的编辑模式下,在选择 "Add a Web Part" 链接之一后展开 "Categories" 下面的 "Upload a Web Part" 部分。我不知道要上传什么(当浏览文件时,文件对话框不会告诉你它期望的文件扩展名),所以我在 flayer 上尝试上传 PostTravelExpense.ascx

它毫不犹豫地接受了它,但我在任何地方都看不到它(我也不知道为什么只有 *.ascx 文件就足够了,但同样,它期望哪个文件?)它不允许我上传整个项目文件夹。

更新 2

针对下面的评论,请注意项目的程序集部署目标" 属性 设置为 GlobalAssembyCache

通过将一个工作项目与这个项目进行比较,我终于能够在没有 "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." 添加时错误消息的情况下部署它。

我必须做的是检查工作项目中引用主命名空间的每个地方,并确保在那些相同的地方引用了先前未工作项目中的相应命名空间

这不仅需要更改 Visual Studio 的解决方案资源管理器树视图中可见的一些文件,还需要更改两个我只能通过搜索它们包含的字符串才能加载到编辑器中的文件,具体来说:

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

对于人们认为 IDE 会自动处理的事情,肯定有很多绞尽脑汁、头撞脑袋和可怜的抱怨[g]——当一个命名空间更改,进行所有必要的更改,或者至少 通知编码人员并主动提出这样做​​!或者,除此之外,至少 给他一个比 "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." 更好的线索,当要放置到页面上的 WebPart 证明无法放置时。