我正在尝试将NLog用于我的WindowsFormsControlLibrary,但它不起作用。有没有办法提供使用我的Control.dll的.exe应用程序?
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- make sure to set 'Copy To Output Directory' option for this file -->
<!-- go to http://nlog-project.org/wiki/Configuration_file for more information -->
<targets>
<target name="file" xsi:type="File" fileName="${basedir}/${shortdate}/file.txt"
layout="${stacktrace} ${longdate} ${message}" />
</targets>
<rules>
<logger name="*" minlevel="Trace" writeTo="file" />
</rules>
</nlog>
答案 0 :(得分:0)
今天早上我也遇到了这个问题。也许,我的解决方案为时已晚,但如果有人需要,我会发布在这里。 nlog之所以无法写文件是因为缺少Nlog.config,这听起来不合理啊?但就是这样,你必须将Nlog.config复制到应用程序文件夹而不是你的DLL文件夹,在你的情况下,它的文件夹包含你的UserControl dll使用的应用程序:)! 如果您无法使用我的解决方案解决问题,请与我联系:tanh1989@gmail.com