C# NLog; Cannot find NLog.xsd file

Mong Zhu picture Mong Zhu · Mar 2, 2016 · Viewed 7.4k times · Source

Just for the case that somebody produces one day the same error.

In the starting section of the NLog.config file Visual Studio tells me (with a warning) that it cannot find the NLog.xsd File

<?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"
      xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"

That is the reason why I cannot use intellisense while editing the config file. Although NLog is installed with the config section and all files are present in the project folder the error persists. Why?

Answer

Phillip H. Blanton picture Phillip H. Blanton · Jan 18, 2018

I fixed the same issue by downloading the schema from "http://www.nlog-project.org/schemas/NLog.xsd" then saving it to my project directory and adding it to the project ...

  • Right click project name in solution explorer.
  • Select Add | Existing item
  • Browse to the new xsd file and select it.

Then the warnings went away.