12

I get the following error:

The global element 'http://www.nlog-project.org/schemas/NLog.xsd:nlog' has already been declared.

And a lot of the following errors with different types:

The complexType 'http://www.nlog-project.org/schemas/NLog.xsd:NLogConfiguration' has already been declared.

The simpleType 'http://www.nlog-project.org/schemas/NLog.xsd:NLogLevel' has already been declared.

I have the following nuget packages installed:

  • NLog
  • NLog Configuration
  • NLog Schema for Intellisense(TM)

3 Answers 3

32

After checking in menu XML > Schemas I realized I had more references to the same schema, so I disabled one of them and this solved the problem.

enter image description here

3
  • Where is this menu item in VS 2013?
    – Grault
    Mar 3, 2015 at 20:23
  • 4
    @Jesdisciple, you will find the menu item in Visual Studio 2013 as david.s explains; XML -> Schemas. If you cannot see this menu item it is probably because your current/active document is not a XML document. Try to open and focus a XML document (e.g. a NLog.config file) then you will see the menu item. Jun 9, 2015 at 12:14
  • 1
    @CasperTaylorKorshøj Aha, thanks. Note to self: Avoid phantom menus.
    – Grault
    Jun 11, 2015 at 21:29
6
<nlog autoReload="true" 
  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 ..\Config\NLog.xsd">
...
</nlog>
3

Fixed this problem by installing NLog.config (don't confuse with actual NLog) package from NuGet.

2
  • 2
    Thanks, this solved my problem. Just install NLog.config from Nuget. May 11, 2017 at 20:41
  • Yeah but what if I don't want the file, since I'm using <nlog> tag inside the app.config?
    – AgentFire
    Dec 10, 2018 at 12:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.