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。
任何線索?
它可能是這個? http://stackoverflow.com/a/8213977/1236044 – jbl
看起來非常相似 - 但是,謝謝,快速修復對我來說還沒有工作。 –
還會在同一個線程中查找其他快速和髒的修復程序:在代碼中明確使用庫的虛擬方法。 – jbl