无法加载文件或程序集或其依赖项之一 [英] Could not load file or assembly or one of its dependencies

查看:46
本文介绍了无法加载文件或程序集或其依赖项之一的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了另一个无法加载文件或程序集或其依赖项之一"的问题.

I'm having another of these "Could not load file or assembly or one of its dependencies" problems.

附加信息:无法加载文件或程序集'Microsoft.Practices.Unity,版本=1.2.0.0,文化=中性,PublicKeyToken=31bf3856ad364e35' 或它的依赖项之一.位于程序集的清单定义确实与程序集引用不匹配.(来自 HRESULT 的异常:0x80131040)

Additional information: Could not load file or assembly 'Microsoft.Practices.Unity, Version=1.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

我不知道是什么导致了这种情况,也不知道如何调试以找到原因.

I have no idea what is causing this or how I could debug it to find the cause.

我已经在我的解决方案目录 .csproj 文件中进行了搜索,并且在我拥有 Unity 的每个地方都进行了搜索:

I've done a search in my solution catalogs .csproj files, and every where I have Unity I have:

参考Include="Microsoft.Practices.Unity,版本=2.0.414.0,文化=中性,PublicKeyToken=31bf3856ad364e35,处理器架构=MSIL"

Reference Include="Microsoft.Practices.Unity, Version=2.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"

在我的任何项目中都找不到任何违反 1.2.0.0 的参考.

Can't find any reference anywhere which goes against 1.2.0.0 in any of my projects.

我应该如何解决这个问题有什么想法吗?

Any ideas how I should go about solving this?

我也很感激有关如何调试此类问题的一般提示.

I would also appreciate tips on how to debug problems like this in general.

推荐答案

  1. 检查您是否引用了一个程序集,而该程序集又引用了旧版本的 unity.例如,假设您有一个名为 ServiceLocator.dll 的程序集,它需要旧版本的 Unity 程序集,现在当您引用 ServiceLocator 时,您应该向它提供旧版本的Unity,这就是问题所在.

  1. Check if you are referencing an assembly which in turn referencing an old version of unity. For example let's say you have an assembly called ServiceLocator.dll which needs an old version of Unity assembly, now when you reference the ServiceLocator you should provide it with the old version of Unity, and that makes the problem.

可能是所有项目构建其程序集的输出文件夹,具有旧版本的统一.

May be the output folder where all projects build their assemblies, has an old version of unity.

您可以使用 FusLogVw 要找出谁在加载旧程序集,只需为日志定义一个路径,然后运行您的解决方案,然后检查(在 FusLogvw 中)加载 Unity 程序集的第一行,双击它并查看调用组装,然后开始.

You can use FusLogVw to find out who is loading the old assemblies, just define a path for the log, and run your solution, then check (in FusLogvw) the first line where the Unity assembly is loaded, double click it and see the calling assembly, and here you go.

这篇关于无法加载文件或程序集或其依赖项之一的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆