From 0a7371c13bcc06fe80587f66e86cc332e66239f8 Mon Sep 17 00:00:00 2001 From: Julian Verdurmen <304NotModified@users.noreply.github.com> Date: Thu, 30 Nov 2017 22:09:44 +0100 Subject: [PATCH 1/2] .NET 4.6.1 + ASP.NET Core 2 support --- .../NLog.Web.AspNetCore.Tests.csproj | 25 +++++++++----- NLog.Web.AspNetCore.Tests/TestBase.cs | 2 +- NLog.Web.AspNetCore/AspNetExtensions.cs | 6 ++-- .../NLog.Web.AspNetCore.csproj | 33 +++++++++---------- NLog.Web.AspNetCore/NLogBuilder.cs | 3 +- 5 files changed, 36 insertions(+), 33 deletions(-) diff --git a/NLog.Web.AspNetCore.Tests/NLog.Web.AspNetCore.Tests.csproj b/NLog.Web.AspNetCore.Tests/NLog.Web.AspNetCore.Tests.csproj index e26470e4..c5b9cdae 100644 --- a/NLog.Web.AspNetCore.Tests/NLog.Web.AspNetCore.Tests.csproj +++ b/NLog.Web.AspNetCore.Tests/NLog.Web.AspNetCore.Tests.csproj @@ -1,33 +1,40 @@  netcoreapp1.1;netcoreapp2.0;net461 - $(DefineConstants);ASP_NET_CORE NLog.Web.AspNetCore.Tests 1.2.3.0 + + + $(DefineConstants);ASP_NET_CORE;ASP_NET_CORE1 + + + $(DefineConstants);ASP_NET_CORE;ASP_NET_CORE2 + + - + - - - + + + - + - + - - + + diff --git a/NLog.Web.AspNetCore.Tests/TestBase.cs b/NLog.Web.AspNetCore.Tests/TestBase.cs index f81e6895..8dc7c89c 100644 --- a/NLog.Web.AspNetCore.Tests/TestBase.cs +++ b/NLog.Web.AspNetCore.Tests/TestBase.cs @@ -26,7 +26,7 @@ public HeaderDict() -#if NETCOREAPP2_0 +#if ASP_NET_CORE2 /// /// Strongly typed access to the Content-Length header. Implementations must keep this in sync with the string representation. /// diff --git a/NLog.Web.AspNetCore/AspNetExtensions.cs b/NLog.Web.AspNetCore/AspNetExtensions.cs index 2da98a1a..18e4e118 100644 --- a/NLog.Web.AspNetCore/AspNetExtensions.cs +++ b/NLog.Web.AspNetCore/AspNetExtensions.cs @@ -10,7 +10,7 @@ using NLog.Web.Internal; using NLog.Extensions.Logging; using NLog.Web.AspNetCore; -#if NETSTANDARD2_0 +#if ASP_NET_CORE2 using Microsoft.Extensions.DependencyInjection; #endif @@ -27,7 +27,7 @@ public static class AspNetExtensions /// Enable NLog Web for ASP.NET Core. /// /// -#if NETSTANDARD2_0 +#if ASP_NET_CORE2 [Obsolete("Use UseNLog() on IWebHostBuilder")] #endif public static void AddNLogWeb(this IApplicationBuilder app) @@ -60,7 +60,7 @@ private static LoggingConfiguration ConfigureNLog(string fileName) } -#if NETSTANDARD2_0 +#if ASP_NET_CORE2 /// /// Apply NLog configuration from XML config. diff --git a/NLog.Web.AspNetCore/NLog.Web.AspNetCore.csproj b/NLog.Web.AspNetCore/NLog.Web.AspNetCore.csproj index 4514fe7d..dd6cad4b 100644 --- a/NLog.Web.AspNetCore/NLog.Web.AspNetCore.csproj +++ b/NLog.Web.AspNetCore/NLog.Web.AspNetCore.csproj @@ -5,8 +5,7 @@ NLog.Web.AspNetCore Julian Verdurmen - netstandard1.3;netstandard1.5;net451;netstandard2.0 - $(DefineConstants);ASP_NET_CORE + netstandard1.3;netstandard1.5;net451;net461;netstandard2.0 true NLog.Web.AspNetCore NLog.snk @@ -51,11 +50,15 @@ NLog.Web - - - + + $(DefineConstants);ASP_NET_CORE;ASP_NET_CORE1 + + + $(DefineConstants);ASP_NET_CORE;ASP_NET_CORE2 + - + + @@ -63,29 +66,23 @@ - + + - - - - - + + - - - + + - - - diff --git a/NLog.Web.AspNetCore/NLogBuilder.cs b/NLog.Web.AspNetCore/NLogBuilder.cs index a3207622..289584ec 100644 --- a/NLog.Web.AspNetCore/NLogBuilder.cs +++ b/NLog.Web.AspNetCore/NLogBuilder.cs @@ -1,5 +1,4 @@ -#if NETSTANDARD2_0 - +#if ASP_NET_CORE2 using System; using System.Collections.Generic; From 3cdae8128125c669823d3afcf16e4c2dd4b46c6a Mon Sep 17 00:00:00 2001 From: Julian Verdurmen <304NotModified@users.noreply.github.com> Date: Fri, 1 Dec 2017 01:04:42 +0100 Subject: [PATCH 2/2] workarround xUnit (MS bug) see xunit/xunit#1573 --- NLog.Web.AspNetCore.Tests/NLog.Web.AspNetCore.Tests.csproj | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/NLog.Web.AspNetCore.Tests/NLog.Web.AspNetCore.Tests.csproj b/NLog.Web.AspNetCore.Tests/NLog.Web.AspNetCore.Tests.csproj index c5b9cdae..e0de7785 100644 --- a/NLog.Web.AspNetCore.Tests/NLog.Web.AspNetCore.Tests.csproj +++ b/NLog.Web.AspNetCore.Tests/NLog.Web.AspNetCore.Tests.csproj @@ -1,17 +1,21 @@  - netcoreapp1.1;netcoreapp2.0;net461 + netcoreapp1.1;netcoreapp2;net461 NLog.Web.AspNetCore.Tests 1.2.3.0 + $(DefineConstants);ASP_NET_CORE;ASP_NET_CORE1 + 2.0.0 $(DefineConstants);ASP_NET_CORE;ASP_NET_CORE2 + +