我正在开发一个通过common.logging,common.logging.nlog和nlog登录的应用程序。日志在应用程序中运行良好 - web.config没问题。
但是 - 当我将日志记录配置应用于测试项目的App.config时,日志记录不起作用,说明:
Unable to create type 'Common.Logging.NLog.NLogLoggerFactoryAdapter, Common.Logging.NLog'
Innerexception是“无法从文件加载程序集”。
这是包裹:
<?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>
修改
这是项目文件
<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>
如果我转到/testresults/.../out文件夹 - 那里有Common.Logging,但没有其他两个必需的libs(common.logging.nlog和nlog)。它们都在项目中被引用并且'copy local'设置为true。
任何线索?