AspNetCoreNlog icon indicating copy to clipboard operation
AspNetCoreNlog copied to clipboard

How to use in .Net core console application

Open SharpNoiZy opened this issue 9 years ago • 11 comments

Hi,

I tried to use your code for a console application, but unfortunately I failed on project.json. I copied nearly everything from your check in web.app project.json but VS can not resolve the dependencies, I have no idea why ;(

And idea?

SharpNoiZy avatar Aug 21 '16 11:08 SharpNoiZy

@SharpNoiZy should work without problem, I'll create a demo

Greetings Damien

damienbod avatar Aug 21 '16 17:08 damienbod

Here's a working demo https://github.com/damienbod/AspNetCoreNlog/tree/consoleDemo/src/ConsoleNLog greetings Damien

damienbod avatar Aug 21 '16 19:08 damienbod

@SharpNoiZy Is this ok now?

Greetings Damien

damienbod avatar Aug 22 '16 12:08 damienbod

@damienbod First of all thank you very much for doing that just for me!

But it seems, that something is wrong with my ASP.NET Tools Preview 2 installation. It doesn't work for me.

issues

issues2

The strange thing is, I have an own .NET Core Console app (Startet to implement your code) where I can add the following packages without issues: correct

But as soon I add NLog it doesn't work. ;(

SharpNoiZy avatar Aug 23 '16 10:08 SharpNoiZy

@SharpNoiZy I'm using this version as well. strange. Try deleting the project.lock.json and check that the global.json is using the right version.

Greetings Damien

damienbod avatar Aug 24 '16 05:08 damienbod

There are no project.lock.jsons

That's what happens if I try dotnet restore restore

This IP is our company internal nuget server, it's clear that he will not find the package there, but why is he searching there anyway?? And it seams that he is only searching there...

SharpNoiZy avatar Aug 24 '16 05:08 SharpNoiZy

Try adding the NuGet feed and move to the top, this is deactivated.Tools/NuGet Package Manager/NuGet Package Settings/Package sources

You need this source https://api.nuget.org/v3/index.json

damienbod avatar Aug 24 '16 05:08 damienbod

Is there, otherwise I could install no packages at all, but that it not the case, just with your solution, and NLog in particular. Newtown.JSON is no problem!

nuget

SharpNoiZy avatar Aug 24 '16 05:08 SharpNoiZy

NLog is a pre-release package. Is this allowed?

Packages are public: https://www.nuget.org/packages/NLog.Extensions.Logging/

damienbod avatar Aug 24 '16 05:08 damienbod

If you can tell me how to allow/disallow, I know just the checkbox inside the GUI, but with Powershell there is no GUI involved.

I did "dotnet restore" not "Install-Package NLog.Extensions.Logging -Pre"

SharpNoiZy avatar Aug 24 '16 05:08 SharpNoiZy

FYI, there is also a tutorial here: https://github.com/NLog/NLog.Extensions.Logging/wiki/Getting-started-with-.NET-Core-2---Console-application

304NotModified avatar Apr 03 '18 21:04 304NotModified