2013-06-12 115 views
0

我正在处理一个应用程序,该应用程序通过common.logging,common.logging.nlog和nlog记录日志。日志记录在应用程序中正常工作 - web.config可以。Common.Logging.Nlog未复制到/testresults/.../out文件夹

但是 - 当我申请的日志记录配置到我的测试项目中的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.nlog和nlog)。它们都在项目中被引用,并将'copy local'设置为true。

任何线索?

+1

它可能是这个? http://stackoverflow.com/a/8213977/1236044 – jbl

+0

看起来非常相似 - 但是,谢谢,快速修复对我来说还没有工作。 –

+1

还会在同一个线程中查找其他快速和脏的修复程序:在代码中明确使用库的虚拟方法。 – jbl

回答

相关问题