log4net and .net Framework 4.0

孤街浪徒 提交于 2019-12-04 13:04:35

In the log4net source code, add a [SecurityCritical] attribute to the Util.ReadOnlyPropertiesDictionary.GetObjectData method and build.

Just compiled the source for target framework 4.0 (not client). Source code of version 1.2.11 already contains this attribute, but be sure to use 'NET_4_0' as a compiler argument. Otherwise, this attribute will not be added.

I've found a compiled version of log4net for .NET client profile here:

http://gosheg.blogspot.com/2011/04/log4net-in-net-40-c-applications-net.html

Chris Ellingsworth

This worked for me:

In the log4net source code, add a [SecurityCritical] attribute to the Util.ReadOnlyPropertiesDictionary.GetObjectData method and build.

There might be some other things you'll need to do to get it to build for the 4.0 framework.

See this post:

Weird override problem with Fluent NHibernate and .NET 4

I have fixed the similar issue by simply updating the Log4Net package from Visual Studio package manager.

Thanks, Khachatur

I Fixed it by adding [assembly: System.Security.SecurityRules(System.Security.SecurityRuleSet.Level1)] to log4net AssemblyInfo but now its not logging

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!