4

我有一个移动 .NET 解决方案,并决定签署程序集。编译完成没有错误,但给出警告

'CompactUI.Business.PocketPC.asmmeta, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' 未正确签名。

该应用程序运行良好,但我无法再打开使用此程序集的表单设计器。设计师又说

'CompactUI.Business.PocketPC.asmmeta, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' 未正确签名。

堆栈信息:

在 Microsoft.CompactFramework.Build.AsmmetaBindingService.GetAsmmetaAssembly(String sourceAssemblyPath, Boolean verify) 在 Microsoft.CompactFramework.Build.AsmmetaBindingService.LoadAsmMetaAssembly(Assembly sourceAssembly, String hintPath, IDeviceTypeResolutionService resolver) 在 Microsoft.CompactFramework.Build.MetadataService.GetAsmmetaType(Type sourceType ) 在 Microsoft.CompactFramework.Build.MetadataService.GetTypeAttributes(Type desktopType) 在 Microsoft.CompactFramework.Design.DeviceCustomTypeDescriptor.GetAttributes() ...

这是什么原因造成的?

编辑:尼古拉斯的建议并没有解决问题

我有一个包含通用属性的表单,这些属性是表示层中每个表单的基础

public class CustomForm : Form
{
    ...
}

此表单位于导致警告的业务层中。在设计器中查看时,从该基本表单继承的每个表单都会导致问题。

4

3 回答 3

1

验证程序集不是使用“延迟符号”设置生成的。这将导致程序集宣传它已签名,而它只有一个null占位符。这将导致强名称验证失败。有关更多信息,您还可以查看 MSDN 上的此页面:“程序集应具有有效的强名称

于 2008-10-22T02:53:13.993 回答
0

我很困惑,你说你签署了程序集,但你的公钥令牌为空,如果你已经签署了这个程序集,那么你应该指定生成的公钥而不是 null。也许我没有完全理解这个问题。尝试删除对 CompactUI.Business.PocketPC.asmmeta 的引用并重新添加签名版本。

于 2008-10-21T17:55:14.143 回答
-2

原因

程序集未使用强名称进行签名,无法验证强名称,或者如果没有计算机的当前注册表设置,强名称将无效。规则说明

此规则检索并验证程序集的强名称。如果以下任何一项为真,则会发生违规行为:

* The assembly does not have a strong name.

* The assembly was altered after signing.

* The assembly is delay-signed.

* The assembly was incorrectly signed, or signing failed.

* The assembly requires registry settings to pass verification. For example, the Strong Name tool (Sn.exe) was used to skip verification for the assembly.

强名称可防止客户端在不知不觉中加载已被篡改的程序集。不应该在非常有限的场景之外部署没有强名称的程序集。如果您共享或分发未正确签名的程序集,则程序集可能会被篡改,公共语言运行时可能不会加载程序集,或者用户可能必须在他或她的计算机上禁用验证。没有强名称的程序集存在以下缺点:

* Its origins cannot be verified.

* The common language runtime cannot warn users if the contents of the assembly have been altered.

* It cannot be loaded into the global assembly cache.

请注意,要加载和分析延迟签名的程序集,您必须禁用程序集的验证。

于 2008-10-22T10:04:20.927 回答