Could not load file or assembly 'Ninject version 4.0.0.0

1

There is a problem with assembly reference, guess occurred when updating nuget packages.

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

<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

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. 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. The located assembly's manifest definition does not match the assembly reference. (Exception from 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?

Thanks in advance.

c#
version-control
nuget
ninject
.net-assembly
asked on Stack Overflow Oct 4, 2017 by M.Khooryani • edited Oct 4, 2017 by Michael Petch

2 Answers

1

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.

What helped me was that I upgraded the Ninject package to the latest version (3.3.4) and 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.

answered on Stack Overflow Sep 15, 2020 by Dániel Erős
0

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:

enter image description here

In the end, these what I have done:

  • Uninstall all Ninject packages in Nuget Package Manager.
  • Remove all Ninject dependentAssembly nodes on web.config file.
  • Then reinstall again the Ninject packages I have before.

Everything work fine after this.

answered on Stack Overflow Apr 22, 2019 by Willy David Jr

User contributions licensed under CC BY-SA 3.0