“Could not load file or assembly” error but I don't know which project is referencing this assembly with old number

为君一笑 提交于 2019-12-08 05:38:00

问题


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)".

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.


回答1:


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.

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.



来源:https://stackoverflow.com/questions/11967632/could-not-load-file-or-assembly-error-but-i-dont-know-which-project-is-refere

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!