创建 nlog.config 个文件时显示 'Could not find schema..' 条消息

'Could not find schema..' messages when nlog.config file is created

当我在项目的根目录中创建 nlog.config 文件时,我收到以下消息

Could not find schema information for the element 'http://www.nlog-project.org/schemas/NLog.xsd:nlog'.  
Could not find schema information for the element 'http://www.nlog-project.org/schemas/NLog.xsd:targets'.       
This is an invalid xsi:type 'http://www.nlog-project.org/schemas/NLog.xsd:File'.    
Could not find schema information for the element 'http://www.nlog-project.org/schemas/NLog.xsd:target'.    
Could not find schema information for the attribute 'name'.     
Could not find schema information for the attribute 'fileName'. 
Could not find schema information for the element 'http://www.nlog-project.org/schemas/NLog.xsd:rules'. 
Could not find schema information for the element 'http://www.nlog-project.org/schemas/NLog.xsd:logger'.    
Could not find schema information for the attribute 'minlevel'.     
Could not find schema information for the attribute 'writeTo'.  

我使用的代码是

        <?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">
    
      <!-- the targets to write to -->
      <targets>
        <!-- write logs to file  -->
        <target name="allfile" xsi:type="File"
                fileName="c:\CsharpTutorials\EmployeeManagement\DemoLogs\nlog-all-${shortdate}.log"/>
      </targets>
    
      <!-- rules to map from logger name to target -->
      <rules>
        <!--All logs, including from Microsoft-->
        <logger name="*" minlevel="Trace" writeTo="allfile" />
      </rules>
    </nlog>

我正在学习教程,这是使用的代码。我该如何解决这个问题?

首先,您必须忽略像 elersong 这样的评论并继续学习。这是学习和研究过程的一部分。

如果您询问架构错误,

Could not find schema information for the element

这对我有用

<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      autoReload="true">
    ...
</nlog>