Could not find schema information for the element ‘log4net’
There is a lot of advice on the web on how to avoid this compilation message for web apps, but not for desktop apps. The easiest way in a desktop app (and possibly also for a web app) is to replace in the C# code
XmlConfigurator.Configure()
with
XmlConfigurator.Configure(new MemoryStream(
(new System.Text.ASCIIEncoding()).GetBytes(
"<log4net>" +
" <appender name=\"ConsoleAppender\" type=\"log4net.Appender.ConsoleAppender\" >" +
" <layout type=\"log4net.Layout.PatternLayout\">" +
" <param name=\"Header\" value=\"[Header]\r\n\" />" +
" <param name=\"Footer\" value=\"[Footer]\r\n\" />" +
" <param name=\"ConversionPattern\" value=\"%d [%t] %-5p %c %m%n\" />" +
" </layout>" +
" </appender>" +
" <root>" +
" <level value=\"DEBUG\" />" +
" <appender-ref ref=\"ConsoleAppender\" />" +
" </root>" +
"</log4net>")));
Or whatever was in your <log4net> stanza in your app.config
No comments:
Post a Comment