无法加载文件或程序集的AssemblyName公钥=空'或一个依赖加载、文件、公钥、程序

2023-09-03 01:36:40 作者:不會回頭

{无法(:0x80131040从HRESULT异常)加载文件或程序集的AssemblyName,公钥=空'或一个依赖找到的程序集清单定义不匹配的程序集的参考。空}

{"Could not load file or assembly 'AssemblyName, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)":"AssemblyName, PublicKeyToken=null"}

我收到的邮件中的问题作为一个 InnerException.Message 试着我的应用程序签名它使用的是未签名的第三方组件后进行调试。 奇怪的是,我已经签署了消息中显示的组​​件,无法加载之一。

I'm getting the message in question as an InnerException.Message while trying to debug my application after signing the unsigned third-party assemblies it is using. The weird thing is that I have already signed the assembly shown in the message, the one that can't be loaded.

还有什么问题在这里?我该如何解决此问题?

What could the problem be here? How can I resolve this?

修改

编辑提供更多的信息,我做了什么:

Editing to give more information on what I did:

签署了所有未签名的第三方组件我的项目所引用。 在拆解这些组件,看看他们是否在内部引用任何外部符号集(他们没有) 删除从项目的参考列表旧签名组件,并重新添加新签的。 卸载的项目和编辑,不能对XML的.sln风格的文件中通过添加组件参照缺少的公钥加载的程序集的引用。

这抛出异常的组件,顺便说一句生成项目精细它是一个运行时异常我得到的的InitializeComponent()的集会,是一个开源的组件WPF控件( MahApps.Metro )。我发现了类似的问题,但没有一个答案有固定的问题。

The assembly that throws the exception, btw the project builds fine it's a runtime exception I'm getting on InitializeComponent() of that assembly, is an open source component with WPF controls (MahApps.Metro). I've found a similar question but none of the answers there fixed the issue.

How强制WPF使用使用程序集强名称资源的URI?哎呀!

推荐答案

公钥=空告诉你,CLR正在寻找的无符号组装。既然你签了字,这不会很好地工作,这KABOOM的预期。

PublicKeyToken = null tells you that the CLR is looking for the unsigned assembly. Since you signed them, that's not going to work well and this kaboom is expected.

您必须的重建的程序,以便它使用最新签名的程序集,并嵌入了非空公钥到清单中。您可能需要删除现有的装配参考,并添加它,它是不是从是否建立使用一个无符号的复制程序的问题清楚了。

You will have to rebuild the program so it uses the updated signed assembly and embeds the non-null PublicKeyToken into the manifest. You may have to remove the existing assembly reference and add it back, it isn't clear from the question whether you built the program using an unsigned copy.

使用的Fuslogvw.exe实用,如果你仍然有问题。

Use the Fuslogvw.exe utility if you still have trouble.

 
精彩推荐
图片推荐