I have this piece of code in .net framework class library project, I want to reuse it in.net standard class library project. It works as expected, but gives compilation error in .net standard project.
foreach (AppenderElement element in FX_CONNECT.EmailElement.Appenders)
{
var smtpElement = (log4net.Appender.SmtpPickupDirAppender)AppLogger.Logger.Repository.GetAppenders().Where(appender => appender.Name.Equals(element.Name)).FirstOrDefault();
if (smtpElement != null)
{
smtpElement.From = FX_CONNECT.EmailElement.From;
smtpElement.To = FX_CONNECT.EmailElement.To;
smtpElement.SmtpHost = FX_CONNECT.EmailElement.Server;
}
}
Error for smtpElement.SmtpHost
:
Error CS1061 'SmtpPickupDirAppender' does not contain a definition for 'SmtpHost' and no accessible extension method 'SmtpHost' accepting a first argument of type 'SmtpPickupDirAppender' could be found (are you missing a using directive or an assembly reference?)
log4net version in both application 2.0.8.
I searched on the internet but didn't get any clue how to solve this issue, please help.
I have gone through the log4net official site, It doesn't support .net standard as of now.
https://logging.apache.org/log4net/release/framework-support.html
So Is there any workaround to solve this?