GDB
GDB

Reputation: 3579

Ninject.Extensions.Logging.nlog2: Could not load file or assembly 'NLog

I used NuGet to install Ninject.Extensions.Logging.nlog2. The GetControllerInstance method in global.asax is throwing the exception "Could not load file or assembly 'NLog, Version=2.0.1.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference."

The Ninject install also installs NLog. I thought something might have gotten fouled up in the NuGet install, or I might have something left from an earlier NLog install, so I used the NuGet package manager to remove NLog and Ninject from the solution, then checked to make sure the DLLs were no longer in the bin folder, and also that the related sections had been cleaned out of web.config and packages.config. Then I closed VS and restarted. Next I used NuGet to do a fresh install of Ninject.Extensions.Logging.nlog2. This did not resolve the problem - same exception gets thrown

I would really like to use Ninject to handle DI with NLog but this is blocking me. Then again, the Ninject extension is preventing me from using NLog 3.0.

Advice or help please. Thanks.

Upvotes: 0

Views: 1044

Answers (1)

Mike_B
Mike_B

Reputation: 46

I've come across the same problem. To fix this you have to update nlog package. Just run

Update-Package nlog -Version 2.0.1.2

from Package manager Console

Upvotes: 3

Related Questions