Log4net DNX link error 451 and 5.0

I am having a problem implementing log4net using DNX in a class library. I have the following in my project .json -

...
"dependencies": {
        "log4net": "2.0.3",
        "Microsoft.Framework.Logging": "1.0.0-beta4"
    },

    "frameworks": {
        "dnx451": { },
        "dnxcore50": {
            "dependencies": {
                "System.Collections": "4.0.10-beta-22816",
                "System.Linq": "4.0.0-beta-22816",
                "System.Threading": "4.0.10-beta-22816",
                "Microsoft.CSharp": "4.0.0-beta-22816"
            }
        }
    }
...

      

When I try to use log4net in a class I get the following error: enter image description here

However, I see a link in the reference folder for both DNX 451 and 50. Does anyone have any thoughts on how I can resolve this?
Also, if I remove dnxcore50 from my project.json file, it seems to resolve and I can compile the project.

+3


source to share


3 answers


I don't believe log4net has been updated for .Net Core, but given that beta1 was released on NuGet on November 11, 2014 and the last log4net was released almost a year before.



You have to either opt out of log4net or not use ASP.Net Core until they release an update ... or connect to log4net

+5


source


You can use NLog with .NET Core. I wrote an example instruction on how to set up this log here



+1


source


As of log4net v2.0.6 they now support NETStandard 1.3 and will work with Core. Although it lacks some features and how you configure it, it still doesn't work the same way.

I wrote a blog post on how to get it to work and set it up: https://stackify.com/making-log4net-net-core-work/

0


source







All Articles