0

I'm working on an application that logs through common.logging, common.logging.nlog and then nlog. Logging works fine in the application - web.config is OK.

However - when I apply the logging configuration to my App.config of the test project, the logging does not work, stating:

Unable to create type 'Common.Logging.NLog.NLogLoggerFactoryAdapter, Common.Logging.NLog'

Innerexception is a 'unable to load assembly from file'.

Here's the packages:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Common.Logging" version="2.1.2" targetFramework="net40" />
  <package id="Common.Logging.NLog" version="2.0.0" targetFramework="net40" />
  <package id="EntityFramework" version="5.0.0" targetFramework="net45" />
  <package id="FakeDbSet" version="1.4.0.0" targetFramework="net45" />
  <package id="FluentAssertions" version="2.0.1" targetFramework="net40" />
  <package id="Moq" version="4.0.10827" targetFramework="net45" />
  <package id="NLog" version="2.0.1.2" targetFramework="net40" />
</packages>

EDIT

And here's the project file

    <Reference Include="Common.Logging, Version=2.1.2.0, Culture=neutral, PublicKeyToken=af08829b84f0328e, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\packages\Common.Logging.2.1.2\lib\net40\Common.Logging.dll</HintPath>
      <Private>True</Private>
    </Reference>
    <Reference Include="Common.Logging.NLog">


<HintPath>..\packages\Common.Logging.NLog.2.0.0\lib\2.0\Common.Logging.NLog.dll</HintPath>
  <Private>True</Private>
</Reference>
    <Reference Include="NLog">
  <HintPath>..\packages\NLog.2.0.1.2\lib\net40\NLog.dll</HintPath>
  <Private>True</Private>
</Reference>

If I go to the /testresults/.../out folder - there is Common.Logging in there, but not the other two required libs ( common.logging.nlog and nlog ). Both of them are referenced in the project AND have 'copy local' set to true.

Any clues?

Jochen van Wylick
  • 5,303
  • 4
  • 42
  • 64
  • 1
    could it be this ? http://stackoverflow.com/a/8213977/1236044 – jbl Jun 12 '13 at 12:56
  • Looks really similar - thanks, however, the quick fix didn't work for me just yet. – Jochen van Wylick Jun 12 '13 at 13:14
  • 1
    also look for the other quick and dirty fix in the same thread : having a dummy method in your code that uses the libraries explicitly. – jbl Jun 12 '13 at 13:24
  • Also tried that - didn't do the trick for me. [AssemblyInitialize] public static void InitAssembly() { var classLogger = Common.Logging.LogManager.GetCurrentClassLogger(); var currentClassLogger = NLog.LogManager.GetCurrentClassLogger(); classLogger.Info("test"); currentClassLogger.Info("test"); } – Jochen van Wylick Jun 12 '13 at 13:48
  • Sorry - that DID work for me - I had to directly access Common.Logging.Nlog too. Thanks! – Jochen van Wylick Jun 12 '13 at 14:12

1 Answers1

0

It's a bug in VS2012 - @jbl helped me out - use this link: stackoverflow.com/a/8213977/1236044

Community
  • 1
  • 1
Jochen van Wylick
  • 5,303
  • 4
  • 42
  • 64