NLog版本4.4.0的依赖性与.netcoreapp版本1不兼容

时间:2017-06-23 16:56:09

标签: c# sql .net asp.net-core nlog

我正在尝试将日志记录添加到.net核心web api项目,但是在添加nlog v 4.4.0时,我收到一条错误消息,表明它与之不兼容。我知道它是净核心v1。

有人能告诉我哪个部分可能导致project.json文件出现问题吗?

"Microsoft.ApplicationInsights.AspNetCore": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.1",
"Microsoft.AspNetCore.Mvc.Formatters.Xml": "1.0.1",
"Microsoft.AspNetCore.Mvc.Formatters.Json": "1.0.1",
"Microsoft.AspNetCore.Routing": "1.0.1",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"NETStandard.Library": "1.6.0",
"System.Data.SqlClient": "4.1.0",
"NLog.Config": "4.4.0",
"NLog": "4.4.0"

2 个答案:

答案 0 :(得分:1)

您今天可以使用NLog.Web.AspNetCore 4.4.1

enter image description here

您似乎正在使用旧方法创建使用project.json的.Net Core应用。新的使用.csproj文件。

Migrating .NET Core projects to the .csproj format

答案 1 :(得分:0)

对于.Net核心,您需要NLog 5(测试版)。另请参阅http://nlog-project.org/2016/10/30/nlog-roadmap-netcore-structural-logging.html

有关设置,请参阅Use NLog in ASP.NET Core application