Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NLog nlogger snippet not working Visual Studio 2012

Does anyone know how to get Nlog's nlogger snippet to work in Visual Studio 2012 like it did in 2010? I don't see anything on their forum or on the internet when googing around. Seems like something that people who use Nlog would want back.

like image 394
gcoleman0828 Avatar asked Nov 27 '12 16:11

gcoleman0828


1 Answers

Haven't worked out how to get the real snippet installed, so I manually created a snippet to perform the same function as the original did.

Create the file nlogger.snippet in the following folder:

My Documents\Visual Studio 2012\Code Snippets\Visual C#\My Code Snippets

The contents of the file should be as follows:

<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <CodeSnippet Format="1.0.0">
        <Header>
            <Title>
                NLog Logger Snippet
            </Title>
            <Shortcut>nlogger</Shortcut>
        </Header>
        <Snippet>
            <Code Language="CSharp">
                <![CDATA[private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();]]>
            </Code>
        </Snippet>
    </CodeSnippet>
</CodeSnippets>

Hopefully this helps someone.

like image 175
Andrew Avatar answered Oct 02 '22 08:10

Andrew