【问题标题】:.net Core - NLog package.net Core - NLog 包
【发布时间】:2016-06-26 20:20:39
【问题描述】:

我有一个使用 NLog nuget 包的 .NET 项目。我想将此移植到 .NET Core - 但 NLog 不能与 .NET Core 一起使用。

NLog 部分基于 System.Configuration 命名空间 - 似乎没有在 .NET Core Framework 中实现。

那么,我可以使用的 nuget 上是否有其他日志库支持 .NET Core?

【问题讨论】:

    标签: nuget nlog .net-core


    【解决方案1】:

    .Net Core 预计会出现在 NLog 4.4 中。它现在处于测试状态,但您可以尝试一下。你可以找到nuget包here

    我在this project看到成功使用Serilog,所以你也可以试试。

    【讨论】:

      【解决方案2】:

      我遇到了同样的问题,但后来我发现 NLog 的稳定版本是

      “NLog”:“4.3.5”

      您可以在依赖项区域的 projet.json 文件中添加上述引用。

      > {
        "version": "1.0.0-*",
        "description": "Business Class Library",
        "authors": [ "Salman.tariq.lone" ],
        "tags": [ "" ],
        "projectUrl": "",
        "licenseUrl": "",
        "frameworks": {
          "net451": {
            "dependencies": {
              "Data": "1.0.0-*",
              "NLog": "4.3.5",
              "HtmlAgilityPack": "1.4.9",
              "RestSharp": "105.2.3",
              "Unofficial.Ionic.Zip": "1.9.1.8"
            }
          }
        },
        "dependencies": {
          "LibGit2Sharp": "1.0.0-*"
        },
        "compilationOptions": {
          "allowUnsafe": true
        }
      }
      

      以上部分是我的 project.json 文件,您可以在其中看到 NLog 参考。它在我的情况下工作。

      【讨论】:

      • 感谢分享。我决定将“NLog”与“4.4.0-betaV15”版本一起使用(所以是测试版,但这对我来说很好。我的 RTM 日期将在 4.4.0 RTM 日期之后......)
      • @leo90skk 很高兴。如果有用,请投票给我的答案。
      猜你喜欢
      • 2019-01-17
      • 1970-01-01
      • 1970-01-01
      • 2018-06-19
      • 1970-01-01
      • 2023-03-05
      • 1970-01-01
      • 2018-11-08
      • 1970-01-01
      相关资源
      最近更新 更多