1

I have a web API asp.net project (.net framework 4.6.1). I imported the Ninject.Web.WebApi.WebHost nuget package, which created a Ninject.Web.Common.cs file in my App_Start folder.

When I try running my web app, I get this error:

System.IO.FileLoadException: 'Could not load file or assembly 'Ninject.Web.Common, 
Version=3.3.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)'

This happens on this line in the Ninject.Web.Common file:

    private static IKernel CreateKernel()
    {
        var kernel = new StandardKernel(); // happens here
        try
        {
            kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => new Bootstrapper().Kernel);
            kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>();
            RegisterServices(kernel);
            return kernel;
        }
        catch
        {
            kernel.Dispose();
            throw;
        }
    }

I have these Ninject packages installed. All their dependencies seem to be fine:

  • Ninject v3.3.4
  • Ninject.Web.Common v3.3.1
  • Ninject.Web.Common.WebHost v3.3.1

What am I doing wrong?

Andrio
  • 1,852
  • 2
  • 25
  • 54
  • Turn on [fusion logging](https://stackoverflow.com/questions/255669/how-to-enable-assembly-bind-failure-logging-fusion-in-net) and troubleshoot your issue using it. – Hamlet Hakobyan Jan 12 '19 at 22:56

1 Answers1

1

Seems like I fixed the problem. What I did was:

  1. I uninstalled those three dependencies
  2. Reinstalled them (same versions)
  3. Also installed Ninject.Web.WebApi
Andrio
  • 1,852
  • 2
  • 25
  • 54