【问题标题】:NLog: Could not find schema information forNLog:找不到架构信息
【发布时间】:2021-12-12 02:35:55
【问题描述】:

我似乎一直在逃避这个答案,我还没有在“互联网”上找到合适的答案。

我正在使用 NLog。我的配置文件的前几行是:

<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    autoReload="true"

有时当我构建我的 VS2019 项目时,没有信息性消息。其他时候,似乎没有改变任何东西,我收到如下消息:

  • 找不到元素“http://www.nlog-project.org/schemas/NLog.xsd:nlog”的架构信息。
  • 找不到属性“autoReload”的架构信息。

...以此类推,直到它在 101 条消息后停止。 "已达到最大错误或警告数。"

我现在处于一个阶段,我现在正在收到这些消息,而不是没有收到它们。我从来没有弄清楚这一点。为什么我得到它们,而其他时候我没有?更重要的是,我需要做些什么才能永久删除这些消息?

当我查看该 URL 中的 XSD 时,它抱怨官方“发布”的 XSD 中有一行。它不喜欢connectionString,如下XSD所示:

<xs:annotation>
  <xs:documentation>Name of the connection string (as specified in <connectionStrings> configuration section.</xs:documentation>
</xs:annotation>

这里的问题是他们的“官方”XSD 吗?我不认为是这种情况,因为我在此解决方案中有另一个项目具有基本相同的 nlog.config,并且在我重建解决方案时不会报告任何信息性消息。就这个项目。我错过了什么?

提前致谢!

更新:今天,在没有对我的代码进行任何更改之后,这些消息都消失了。从现在到发布此内容时,我没有对 XSD 进行全面比较。和以前一样,connectionStrings 部分仍然在它们的 XSD 中。看起来完全没有改变。这里发生了什么?

【问题讨论】:

    标签: xsd nlog


    【解决方案1】:

    XSD 无效,因为这不是格式正确的 xml:

    <xs:annotation>
      <xs:documentation>Name of the connection string (as specified in <connectionStrings> configuration section.</xs:documentation>
    </xs:annotation>
    

    应该是:

    <xs:annotation>
      <xs:documentation>Name of the connection string (as specified in &lt;connectionStrings&gt; configuration section.</xs:documentation>
    </xs:annotation>
    

    或许:

    <xs:annotation>
      <xs:documentation><![CDATA[Name of the connection string (as specified in <connectionStrings> configuration section.]]></xs:documentation>
    </xs:annotation>
    

    我建议您在查看其他内容之前先解决此问题。

    【讨论】:

    • 当然,除了问题是我链接到的是 NLog 的官方 XSD,而不是我自己创建的东西。
    • 在这种情况下,您应该要求 NLog 发布其 XSD 的更正版本。
    猜你喜欢
    • 2010-09-15
    • 1970-01-01
    • 1970-01-01
    • 2012-12-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-29
    相关资源
    最近更新 更多