我有两个项目的解决方案
SharePoint.Project
Web.Project
SharePoint.Project包含对Web.Project的引用。SharePoint.Project将来自Web.Project的输出打包并将其部署到GAC。在部署解决方案之后,SharePoint.Project.DLL和Web.Project.DLL都存在于GAC中,而我的sharepoint站点的web.config包括一个SafeControl,该SafeControl标识程序集"Web.Project.DLL“的FullName、Namespace "Web.Project.WebParts”和Type "*“。
问题
尝试将add部件添加到sharepoint站点中的页面时,会出现以下错误
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.发布于 2013-11-21 21:31:43
这个问题可能还有另一种解决方案,但我最后所做的是在SharePoint.Project中创建一个WebPart.cs文件,并让它从Web.Project派生出来,并将Elements.xml和WebPart.webpart文件更改为引用SharePoint.Project中的WebPart.cs
发布于 2013-11-23 19:18:45
您应该检查安全控制dll的版本号和publickeytoken。这些属性必须与部署在GAC中的dll类似。
https://stackoverflow.com/questions/20132345
复制相似问题