Reputation: 265
I have a dotnet core 1.1 application (In VS, targets .NETCoreApp 1.1). I can't install NLog 4.4.11 via NuGet because it has a dependency on dotnet framework. Nuget reports the following:
Package NLog 4.4.11 is not compatible with netcoreapp1.1
(.NETCoreApp,Version=v1.1). Package NLog 4.4.11 supports:
- monoandroid10 (MonoAndroid,Version=v1.0)
- net35 (.NETFramework,Version=v3.5)
- net40 (.NETFramework,Version=v4.0)
- net45 (.NETFramework,Version=v4.5)
- sl4 (Silverlight,Version=v4.0)
- sl5 (Silverlight,Version=v5.0)
- wp8 (WindowsPhone,Version=v8.0)
- xamarinios10 (Xamarin.iOS,Version=v1.0)
So far so good.
However, NLog.Extensions.Logging (https://github.com/NLog/NLog.Extensions.Logging) is supposed to work against dotnet core, so I installed it. In VS 2017, this project includes NLog 4.4.11 as a dependency.
This is confusing because I can't use NLog directly, but can at one remove?
Anyone have some insight on this?
Upvotes: 1
Views: 309
Reputation: 36770
For .NET Core 1 you need the betas of NLog 5.
The confusing part is here that ASP.NET Core can also run on the full .NET framework (e.g. .NET 4.6).
The NLog.Extensions.Logging is meant for ASP.NET Core and .NET Core console applications, hence this one works also for ASP.NET Core when running on the full .NET framework.
Upvotes: 1
Reputation: 28310
You could consider an option to add a Standard 2.0
library project between logging with NLog
and your projects you'd like to log from.
In brief the scheme is the following:
Standard-2-Project
- wraps logging component and has dependency to NLog 4.4.11
packageNET-4-Project-A
- uses Standard-2-Project
for loggingNET-4-Project-B
- uses Standard-2-Project
for loggingNET-Core-Project-C
- uses Standard-2-Project
for loggingNET-Core-Project-D
- uses Standard-2-Project
for logging...
- uses Standard-2-Project
for loggingHope that helps.
Upvotes: 0