gpt4 book ai didi

sharepoint - 更改 AssemblyVersion 后的 Webpart "Not registered as safe"

转载 作者:行者123 更新时间:2023-12-01 10:08:40 25 4
gpt4 key购买 nike

我(成功)部署了一些 sharepoint2010 - 使用 msbuild 的 Webparts。一切正常,直到我决定更改 assemblyVersion。每当我这样做时,消息

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

一个解决方案是继续使用 1.0.0.0,但应该有更好的方法...

也许值得一提的是,我们使用了一个集中式的 AssemblyFile,它作为链接包含在内。

list 包含正确的程序集版本:

<Assemblies>
<Assembly Location="RTContacts.dll" DeploymentTarget="GlobalAssemblyCache">
<SafeControls>
<SafeControl Assembly="RTContacts, Version=1.0.4325.18399, Culture=neutral, PublicKeyToken=2721ba85ef1e4b88" Namespace="RTContacts" TypeName="*" />
</SafeControls>
</Assembly>

当我再次将 WebPart 添加到该站点时,它显示正确,但现有的 webPart 似乎链接到旧版本。

最佳答案

您遇到这些问题是因为您错误地使用了版本控制属性。

例如,如果您在 Reflector 中检查 Microsoft.SharePoint.dll,您将看到 v14.0.0.0(适用于 SharePoint 2010)。

对于 Beta、RCx、RTM 所有服务包和 CU 等,此 AssemblyVersion 将保持完全相同 - 唯一改变的是 AssemblyFileVersion(这是您在 Windows 资源管理器中的属性下看到)

详情请看这里

SharePoint features: How can I use wildcard assembly versioning?

但不要相信我的话 - Microsoft KB556041 - How to use Assembly Version and Assembly File Version

如果您遵循此操作,则不需要程序集绑定(bind)重定向,并且当您更新您的 Web 部件时,现有实例将不会被破坏。

关于sharepoint - 更改 AssemblyVersion 后的 Webpart "Not registered as safe",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8006500/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com