Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NLog Custom Target XSD Warnings

I have created a custom target for NLog and it works fine, but when I am editing the nlog.config file I get a warning that This is an invalid xsi:type 'http://www.nlog-project.org/schemas/NLog.xsd:LogMillMessageBus'

This is my nlog.config file:

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

    <extensions>
        <add assembly="Core.v40.NLog.Extensions"/>
    </extensions>

    <targets async="true">
        <target name="LogMillMessageBus" xsi:type="LogMillMessageBus"/>

        <target name="Console" xsi:type="ColoredConsole" layout="${date:format=HH\:mm\:ss.fff} ${message} ${exception:format=tostring}${event-context:item=Details}"/>
    </targets>

    <rules>
        <logger name="*" minlevel="Trace" writeTo="Console" />
        <logger name="*" minlevel="Debug" writeTo="LogMillMessageBus" />
    </rules>
</nlog>

Can I somehow create my own xsd that appends http://nlog-project.org/schemas/NLog.xsd so that I wont get the warning?

like image 519
BrandonAGr Avatar asked Apr 25 '11 23:04

BrandonAGr


1 Answers

The easy way is to install this package https://nuget.org/packages/NLog.Schema/2.0.1.2

The hard way (my first way) is to get that missing xsd and tell visual studio to use it.

You can get the xsd from this page http://nlog.codeplex.com/releases/view/32639. I downloaded the version NLog2.netfx40.zip, unpacked it and copied NLog.netfx40.xsd to the root of my project. To tell Vusual Studio to use it you should open up the menu "XML->Schemas..." (XML menu appears between TEAM and TOOLS if you open an xml file for editing) and add the xsd file. Now in my case the last problem was the wrong xmlns. So I changed it in my config from http://www.nlog-project.org/schemas/NLog.xsd to http://www.nlog-project.org/schemas/NLog.netfx40.xsd.

like image 165
Stanislav Avatar answered Oct 03 '22 23:10

Stanislav