StillLearning
StillLearning

Reputation: 111

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

When I create a nlog.config file in the root of my project , I get the following messages

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'.  

The code that I used was

        <?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>

I am following a tutorial and this was the code that was used. How can I rectify the problem?

Upvotes: 2

Views: 1083

Answers (1)

Devin
Devin

Reputation: 100

First, you'll have to ignore comments like elersong's and keep learning. This is part of the learning and research process.

If you're asking about the schema errors,

Could not find schema information for the element

this worked for me

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

Upvotes: 1

Related Questions