"无法加载文件或程序集"错误,但我不知道是哪个项目引用该组件与老字号但我、老字号、组件、加载

2023-09-04 04:09:13 作者:疯狂啲想唸

当我启动我的WPF应用程序,我得到了错误无法加载文件或程序集ASSEMBLY_NAME,版本= 0.4010.4609.26378,文化=中性公钥='XXX'或一个依赖。找到的程序集清单定义不会(从HRESULT异常:0x80131040)匹配的程序集的参考。

When I am launching my WPF application, I got the error "Could not load file or assembly 'ASSEMBLY_NAME, Version=0.4010.4609.26378, Culture=neutral, PublicKeyToken='XXX' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)".

的ASSEMBLY_NAME是一个项目,这是由许多其他项目引用的,因为它是一个核心的名称。我的WPF项目还引用它,而有些项目引用ASSEMBLY_NAME是我的WPF项目的参考。然而,无论WPF项目和它引用这些引用ASSEMBLY_NAME,他们都引用版本0.4010.4610.xxxx。所以,尽管我明白为什么这个错误发生 - 这是因为旧版本的目标,但是我只有较新的版本,我无法找出哪些项目或部分引用的版本0.4010.4609.xxxx。正如我所说,启动项目,我的WPF项目不是。谁能告诉我如何检查谁是引用了吗?谢谢你。

The ASSEMBLY_NAME is the name of one project, which is referenced by many other projects because it is a core. My WPF project is also referencing it, and some projects referencing ASSEMBLY_NAME are references of my WPF project. However, both WPF project and its references which are referencing ASSEMBLY_NAME, they all reference the version 0.4010.4610.xxxx. So even though I understand why this error happens--it's because an older version is the target however I only have newer version, I can't find out which project or part is referencing the version 0.4010.4609.xxxx. As I mentioned, the startup project, my WPF project is not. Could anyone tell me how to check who is referencing it? Thanks.

推荐答案

您可以检查每个引用的属性来ASSEMBLY_NAME并确认您看到的路径是一样的东西 ASSEMBLY_NAME \斌\调试,而不是 PROJECT_CONTAINING_THE_REFERENCE \斌\调试

You can check the properties of each reference to ASSEMBLY_NAME and verify that the path you see is something like ASSEMBLY_NAME\bin\Debug and not PROJECT_CONTAINING_THE_REFERENCE\bin\Debug.

另外,您可以删除该项目所有的 OBJ 文件夹,并做了全部重建。您的一个项目失败了大楼。这是一个用错误的参考。

Alternatively you can delete all your bin and obj folders in the projects and do a Rebuild All. One of your projects should fail building. That's the one with the wrong reference.