[英]Could not load file or assembly 'Ninject version 4.0.0.0
There is a problem with assembly reference, guess occurred when updating nuget packages.程序集引用有问题,在更新 nuget 包时发生了猜测。
I start from a project which has no dependency to most dependencies(topological sort) reinstalled all nuget packages and increase version in nuspec
file and all packages.config
files referenced to Ninject 3.2.2.0我从一个对大多数依赖项(拓扑排序)没有依赖关系的项目开始,重新安装了所有 nuget 包并增加了
nuspec
文件和所有引用Ninject 3.2.2.0 的packages.config
文件中的版本
<package id="Ninject" version="3.2.2.0" targetFramework="net462" />
<package id="Ninject.Extensions.Conventions" version="3.2.0.0" targetFramework="net462" />
but doesn't work.但不起作用。
still getting error when running unit test, seems an assembly referenced to other version of Ninject运行单元测试时仍然出错,似乎是引用了其他版本的Ninject的程序集
unit test fails:单元测试失败:
Message: System.IO.FileLoadException : Could not load file or assembly 'Ninject, Version=4.0.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7' or one of its dependencies.
消息:System.IO.FileLoadException:无法加载文件或程序集“Ninject,版本=4.0.0.0,Culture=neutral,PublicKeyToken=c7192dc5380945e7”或其依赖项之一。 The located assembly's manifest definition does not match the assembly reference.
定位的程序集的清单定义与程序集引用不匹配。 (Exception from HRESULT: 0x80131040) ---- System.IO.FileLoadException : Could not load file or assembly 'Ninject, Version=3.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7' or one of its dependencies.
(来自 HRESULT 的异常:0x80131040)---- System.IO.FileLoadException:无法加载文件或程序集“Ninject,版本=3.2.0.0,Culture=neutral,PublicKeyToken=c7192dc5380945e7”或其依赖项之一。 The located assembly's manifest definition does not match the assembly reference.
定位的程序集的清单定义与程序集引用不匹配。 (Exception from HRESULT: 0x80131040)
(来自 HRESULT 的异常:0x80131040)
how to get more informations about this(who's calling version 4.0.0.0 or 3.2.0.0) or fix this issue?如何获取有关此的更多信息(谁在调用版本 4.0.0.0 或 3.2.0.0)或解决此问题?
Thanks in advance.提前致谢。
I had the same problem, I upgraded my project to 4.6.2 from 4.5 which used Ninject version 3.2.2.0, and I got the same error message.我遇到了同样的问题,我将我的项目从使用 Ninject 3.2.2.0 版的 4.5 升级到 4.6.2,并且我收到了相同的错误消息。
What helped me was that I upgraded the Ninject package to the latest version (3.3.4) and Ninject.Web.Common (3.3.2).帮助我的是我将 Ninject 包升级到最新版本 (3.3.4) 和 Ninject.Web.Common (3.3.2)。
Warning!警告! When I did so, my NinjectWebCommon.cs file was re-generated and I lost all dependency injection settings, but once I restored it from source control, everything was fine.
当我这样做时,我的 NinjectWebCommon.cs 文件被重新生成并且我丢失了所有依赖注入设置,但是一旦我从源代码管理中恢复它,一切都很好。
I have the same issue.我有同样的问题。 I tried to edit my project file to check my dependency versions but it is okay.
我试图编辑我的项目文件来检查我的依赖版本,但没关系。
I also tried to edit my web.config file since the dependency versions are there:我还尝试编辑我的 web.config 文件,因为依赖版本在那里:
In the end, these what I have done:最后,这些是我所做的:
Everything work fine after this.在此之后一切正常。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.