nlogを介してコンソールにログインしようとしていますが、例外が発生しています。
Unhandled Exception: System.TypeInitializationException: The type initializer fo
r 'MyApp' threw an exception. ---> System.Configuration.ConfigurationEr
rorsException: An error occurred creating the configuration section handler for
nlog: Exception occurred when loading configuration from C:\MyApp\MyApp.exe.config (C:\MyApp\MyApp.exe.config line 14) --->
NLog.NLogConfigurationException: Exception occurred when loading configuration f
rom C:\MyApp\MyApp.exe.config ---> System.ArgumentException: T
arget cannot be found: 'Console'
at NLog.Config.Factory`2.CreateInstance(String name)
at NLog.Config.XmlLoggingConfiguration.ParseTargetsElement(NLogXmlElement tar
getsElement)
at NLog.Config.XmlLoggingConfiguration.ParseNLogElement(NLogXmlElement nlogEl
ement, String baseDirectory)
at NLog.Config.XmlLoggingConfiguration.ParseTopLevel(NLogXmlElement content,
String baseDirectory)
at NLog.Config.XmlLoggingConfiguration.Initialize(XmlReader reader, String fi
leName, Boolean ignoreErrors)
--- End of inner exception stack trace ---
at NLog.Config.XmlLoggingConfiguration.Initialize(XmlReader reader, String fi
leName, Boolean ignoreErrors)
at NLog.Config.XmlLoggingConfiguration..ctor(XmlElement element, String fileN
ame)
at NLog.Config.ConfigSectionHandler.System.Configuration.IConfigurationSectio
これが私の設定ファイルです:
<configuration>
<configSections>
<section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog"/>
</configSections>
<nlog>
<targets>
<target name="c" type="Console" />
<!--<target name="logfile" type="File" fileName="log.txt" archiveAboveSize="10240" maxArchiveFiles="-1" />-->
</targets>
<rules>
<logger name="*" minlevel="Info" writeTo="c" />
</rules>
</nlog>
</configuration>
関連するコードは次のとおりです。
private static Logger logger = LogManager.GetLogger("MyApp");
私は次のコマンドでmonoをコンパイルしています:
dmcs -reference:NLog.dll MyApp.cs
最新のものを使用していますか?ここからのnlogのバージョン、そして私は.Netフレームワークの4.0を持っています。このアプリはWindows7Home PC(.Net 4.0も)で正常に動作しますが、私のXPproPCではこの例外をスローするようです。それが違いになるとは想像できませんが、.Netダミーであるため、問題が何であるかについて途方に暮れています。
誰かがこれを以前に見たことがありますか、または問題が何である可能性があるかについて何か洞察を持っていますか?