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?