From 8f0a9ba0b3bfd59e15ada039b0a55b93d03014cb Mon Sep 17 00:00:00 2001 From: Julian Verdurmen <304NotModified@users.noreply.github.com> Date: Fri, 29 Sep 2017 16:06:44 +0200 Subject: [PATCH] rename NETSTANDARD_1plus => ASP_NET_CORE --- .../DefaultHttpContextAccessorTests.cs | 2 +- NLog.Web.AspNetCore.Tests/FakeHttpContextAccessor.cs | 2 +- .../AspNetApplicationValueLayoutRendererTests.cs | 2 +- .../AspNetCookieLayoutRendererTests.cs | 12 ++++++------ .../AspNetItemValueLayoutRendererTests.cs | 6 +++--- .../LayoutRenderers/AspNetMvcActionRendererTests.cs | 4 ++-- .../AspNetMvcControllerRendererTests.cs | 4 ++-- .../AspNetQueryStringLayoutRendererTests.cs | 4 ++-- .../AspNetRequestHttpMethodRendererTests.cs | 4 ++-- .../AspNetRequestReferrerRendererTests.cs | 4 ++-- .../LayoutRenderers/AspNetRequestUrlRendererTests.cs | 4 ++-- .../LayoutRenderers/AspNetRequestUserAgentTests.cs | 4 ++-- .../AspNetRequestValueLayoutRendererTests.cs | 4 ++-- .../AspNetSessionIDLayoutRendererTests.cs | 4 ++-- .../AspNetSessionValueLayoutRendererTests.cs | 4 ++-- .../AspNetUserAuthTypeLayoutRendererTests.cs | 2 +- .../AspNetUserIdentityLayoutRendererTests.cs | 2 +- .../TestInvolvingAspNetHttpContext.cs | 8 ++++---- .../NLog.Web.AspNetCore.Tests.csproj | 2 +- NLog.Web.AspNetCore.Tests/TestBase.cs | 8 ++++---- NLog.Web.AspNetCore/DefaultHttpContextAccessor.cs | 4 ++-- NLog.Web.AspNetCore/IHttpContextAccessor.cs | 2 +- NLog.Web.AspNetCore/Internal/PropertyReader.cs | 2 +- .../Internal/RequestAccessorExtension.cs | 4 ++-- .../AspNetApplicationValueLayoutRenderer.cs | 2 +- .../AspNetEnvironmentLayoutRenderer.cs | 2 +- .../LayoutRenderers/AspNetItemValueLayoutRenderer.cs | 2 +- .../LayoutRenderers/AspNetLayoutRendererBase.cs | 8 ++++---- .../LayoutRenderers/AspNetMvcActionRenderer.cs | 4 ++-- .../LayoutRenderers/AspNetMvcControllerRenderer.cs | 4 ++-- .../LayoutRenderers/AspNetMvcLayoutRendererBase.cs | 2 +- .../AspNetRequestContentTypeLayoutRenderer.cs | 2 +- .../AspNetRequestCookieLayoutRenderer.cs | 4 ++-- .../AspNetRequestHostLayoutRenderer.cs | 4 ++-- .../AspNetRequestHttpMethodRenderer.cs | 4 ++-- .../LayoutRenderers/AspNetRequestIpLayoutRenderer.cs | 4 ++-- .../AspNetRequestQueryStringLayoutRenderer.cs | 8 ++++---- .../LayoutRenderers/AspNetRequestReferrerRenderer.cs | 4 ++-- .../LayoutRenderers/AspNetRequestUrlRenderer.cs | 4 ++-- .../AspNetRequestValueLayoutRenderer.cs | 12 ++++++------ .../LayoutRenderers/AspNetRequestuseragent.cs | 4 ++-- .../LayoutRenderers/AspNetSessionIdLayoutRenderer.cs | 4 ++-- .../AspNetSessionValueLayoutRenderer.cs | 4 ++-- .../AspNetUserAuthTypeLayoutRenderer.cs | 2 +- .../AspNetUserIdentityLayoutRenderer.cs | 2 +- .../LayoutRenderers/AssemblyVersionLayoutRenderer.cs | 11 +++++++---- .../LayoutRenderers/IISInstanceNameLayoutRenderer.cs | 10 +++++----- NLog.Web.AspNetCore/NLog.Web.AspNetCore.csproj | 6 +++--- NLog.Web.AspNetCore/NLogHttpModule.cs | 2 +- NLog.Web.AspNetCore/Targets/AspNetTrace.cs | 2 +- .../Targets/Wrappers/AspNetBufferingTargetWrapper.cs | 2 +- 51 files changed, 110 insertions(+), 107 deletions(-) diff --git a/NLog.Web.AspNetCore.Tests/DefaultHttpContextAccessorTests.cs b/NLog.Web.AspNetCore.Tests/DefaultHttpContextAccessorTests.cs index 54ed744e..c7e13e0d 100644 --- a/NLog.Web.AspNetCore.Tests/DefaultHttpContextAccessorTests.cs +++ b/NLog.Web.AspNetCore.Tests/DefaultHttpContextAccessorTests.cs @@ -1,4 +1,4 @@ -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE using System.IO; using System.Text; using System.Web; diff --git a/NLog.Web.AspNetCore.Tests/FakeHttpContextAccessor.cs b/NLog.Web.AspNetCore.Tests/FakeHttpContextAccessor.cs index d9e3534a..37865ff0 100644 --- a/NLog.Web.AspNetCore.Tests/FakeHttpContextAccessor.cs +++ b/NLog.Web.AspNetCore.Tests/FakeHttpContextAccessor.cs @@ -1,4 +1,4 @@ -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE using System.Web; using System.Collections.Specialized; using System.Web.SessionState; diff --git a/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetApplicationValueLayoutRendererTests.cs b/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetApplicationValueLayoutRendererTests.cs index 813a5fdc..52a28a6f 100644 --- a/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetApplicationValueLayoutRendererTests.cs +++ b/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetApplicationValueLayoutRendererTests.cs @@ -1,4 +1,4 @@ -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE using System; using System.Collections.Generic; using System.Globalization; diff --git a/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetCookieLayoutRendererTests.cs b/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetCookieLayoutRendererTests.cs index 5816f5e9..3ab5a227 100644 --- a/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetCookieLayoutRendererTests.cs +++ b/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetCookieLayoutRendererTests.cs @@ -13,7 +13,7 @@ using NLog.Layouts; using NLog.Targets; -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE using System.Web; using System.Collections.Specialized; using System.Web.SessionState; @@ -77,7 +77,7 @@ public void KeyNotFoundRendersEmptyString_Json_Formatting() [Fact] public void KeyFoundRendersValue_Cookie_Mulitple_Items_Flat_Formatting() { -#if NETSTANDARD_1plus +#if ASP_NET_CORE //no multivalue keys in ASP.NET core var expectedResult = "key=TEST,Key1=TEST1"; #else @@ -95,7 +95,7 @@ public void KeyFoundRendersValue_Cookie_Mulitple_Items_Flat_Formatting() [Fact] public void KeyFoundRendersValue_Cookie_Multiple_Items_Flat_Formatting_separators() { -#if NETSTANDARD_1plus +#if ASP_NET_CORE //no multivalue keys in ASP.NET core var expectedResult = "key:TEST|Key1:TEST1"; #else @@ -170,7 +170,7 @@ public void KeyFoundRendersValue_Cookie_Mulitple_Items_Json_Formatting(bool sing } //no multivalue keys in ASP.NET core -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE [Fact] public void KeyFoundRendersVakue_Cookie_Mulitple_Cookies_Cookie_Items_Flat_Formatting() @@ -199,7 +199,7 @@ public void KeyFoundRendersVakue_Cookie_Mulitple_Cookies_Cookie_Items_Json_Forma } #endif -#if !NETSTANDARD_1plus //todo +#if !ASP_NET_CORE //todo [Fact] public void CommaSeperatedCookieNamesTest_Mulitple_FLAT_Formatting() @@ -268,7 +268,7 @@ private static AspNetRequestCookieLayoutRenderer CreateRenderer(bool addKey = tr var httpContext = Substitute.For(); -#if NETSTANDARD_1plus +#if ASP_NET_CORE IRequestCookieCollection cookies = Substitute.For(); var cookieDict = new Dictionary(); diff --git a/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetItemValueLayoutRendererTests.cs b/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetItemValueLayoutRendererTests.cs index d1b8f1e9..c606cff2 100644 --- a/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetItemValueLayoutRendererTests.cs +++ b/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetItemValueLayoutRendererTests.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Globalization; -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE using System.Web; using System.Collections.Specialized; using System.Web.SessionState; @@ -59,7 +59,7 @@ public void VariableNotFoundRendersEmptyString() public void CulturedVariableFoundRendersValue(object expectedValue) { var httpContext = Substitute.For(); -#if NETSTANDARD_1plus +#if ASP_NET_CORE httpContext.Items = new Dictionary(); httpContext.Items.Add("key", expectedValue); #else @@ -81,7 +81,7 @@ public void CulturedVariableFoundRendersValue(object expectedValue) public void VariableFoundRendersValue(object expectedValue) { var httpContext = Substitute.For(); -#if NETSTANDARD_1plus +#if ASP_NET_CORE httpContext.Items = new Dictionary(); httpContext.Items.Add("key", expectedValue); #else diff --git a/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetMvcActionRendererTests.cs b/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetMvcActionRendererTests.cs index 0c425714..56ccae2d 100644 --- a/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetMvcActionRendererTests.cs +++ b/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetMvcActionRendererTests.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Globalization; -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE using System.Web; using System.Collections.Specialized; using System.Web.SessionState; @@ -23,7 +23,7 @@ public class AspNetMvcActionRendererTests : TestBase public void NullRoutesRenderersEmptyString() { var httpContext = Substitute.For(); -#if NETSTANDARD_1plus +#if ASP_NET_CORE var routingFeature = Substitute.For(); var collection = new FeatureCollection(); collection.Set(routingFeature); diff --git a/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetMvcControllerRendererTests.cs b/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetMvcControllerRendererTests.cs index bc8ba4ed..aaf555fc 100644 --- a/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetMvcControllerRendererTests.cs +++ b/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetMvcControllerRendererTests.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Globalization; -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE using System.Web; using System.Web.Routing; using System.Collections.Specialized; @@ -25,7 +25,7 @@ public class AspNetMvcControllerRendererTests : TestBase public void NullRoutesRenderersEmptyString() { var httpContext = Substitute.For(); -#if NETSTANDARD_1plus +#if ASP_NET_CORE var routingFeature = Substitute.For(); var collection = new FeatureCollection(); collection.Set(routingFeature); diff --git a/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetQueryStringLayoutRendererTests.cs b/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetQueryStringLayoutRendererTests.cs index d5d2c9e8..706b5101 100644 --- a/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetQueryStringLayoutRendererTests.cs +++ b/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetQueryStringLayoutRendererTests.cs @@ -3,7 +3,7 @@ using System; using System.Collections.Generic; using System.Globalization; -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE using System.Web; using System.Web.Routing; using System.Collections.Specialized; @@ -203,7 +203,7 @@ private static AspNetQueryStringLayoutRenderer CreateAndMockRenderer(params Tupl { var renderer = new AspNetQueryStringLayoutRenderer(); -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE var httpContext = Substitute.For(); var namedClollection = new NameValueCollection(); diff --git a/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetRequestHttpMethodRendererTests.cs b/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetRequestHttpMethodRendererTests.cs index 5c704d1b..59f8302d 100644 --- a/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetRequestHttpMethodRendererTests.cs +++ b/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetRequestHttpMethodRendererTests.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Globalization; -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE using System.Web; using System.Web.Routing; using System.Collections.Specialized; @@ -36,7 +36,7 @@ public void NullUrlRendersEmptyString() public void HttpMethod_Set_Renderer() { var httpContext = Substitute.For(); -#if NETSTANDARD_1plus +#if ASP_NET_CORE httpContext.Request.Method.Returns("POST"); #else httpContext.Request.HttpMethod.Returns("POST"); diff --git a/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetRequestReferrerRendererTests.cs b/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetRequestReferrerRendererTests.cs index 63fd03a4..851b0381 100644 --- a/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetRequestReferrerRendererTests.cs +++ b/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetRequestReferrerRendererTests.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Globalization; -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE using System.Web; using System.Web.Routing; using System.Collections.Specialized; @@ -38,7 +38,7 @@ public void NullReferrerRendersEmptyString() public void ReferrerPresentRenderNonEmptyString() { var httpContext = Substitute.For(); -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE httpContext.Request.UrlReferrer.Returns(new Uri("http://www.google.com/")); #else var headers = new HeaderDict(); diff --git a/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetRequestUrlRendererTests.cs b/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetRequestUrlRendererTests.cs index 09d16b5d..c217903b 100644 --- a/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetRequestUrlRendererTests.cs +++ b/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetRequestUrlRendererTests.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Globalization; -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE using System.Web; using System.Web.Routing; using System.Collections.Specialized; @@ -164,7 +164,7 @@ private static AspNetRequestUrlRenderer CreateRenderer(string hostBase, string q { var httpContext = Substitute.For(); -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE var url = $"{scheme}://{hostBase}{pathBase}{page}{queryString}"; httpContext.Request.Url.Returns(new Uri(url)); #else diff --git a/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetRequestUserAgentTests.cs b/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetRequestUserAgentTests.cs index 0bb031f9..8fbe478f 100644 --- a/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetRequestUserAgentTests.cs +++ b/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetRequestUserAgentTests.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Globalization; -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE using System.Web; using System.Web.Routing; using System.Collections.Specialized; @@ -37,7 +37,7 @@ public void NotNullUserAgentRendersEmptyString() var httpContext = Substitute.For(); -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE httpContext.Request.UserAgent.Returns("TEST"); #else var headers = new HeaderDict(); diff --git a/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetRequestValueLayoutRendererTests.cs b/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetRequestValueLayoutRendererTests.cs index 3465a798..be4b2814 100644 --- a/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetRequestValueLayoutRendererTests.cs +++ b/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetRequestValueLayoutRendererTests.cs @@ -1,8 +1,8 @@ -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE //TODO test .NET Core using System.Collections.Specialized; using System.IO; -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE using System.Web; using System.Web.Routing; using System.Web.SessionState; diff --git a/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetSessionIDLayoutRendererTests.cs b/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetSessionIDLayoutRendererTests.cs index a53d219e..794879f0 100644 --- a/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetSessionIDLayoutRendererTests.cs +++ b/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetSessionIDLayoutRendererTests.cs @@ -1,6 +1,6 @@ -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE //TODO test .NET Core -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE using System.Web; using System.Web.Routing; using System.Collections.Specialized; diff --git a/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetSessionValueLayoutRendererTests.cs b/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetSessionValueLayoutRendererTests.cs index 07a6be2a..8e819316 100644 --- a/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetSessionValueLayoutRendererTests.cs +++ b/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetSessionValueLayoutRendererTests.cs @@ -1,9 +1,9 @@ -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE //TODO test .NET Core using System; using System.Reflection; -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE using System.Web; using System.Web.Routing; using System.Collections.Specialized; diff --git a/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetUserAuthTypeLayoutRendererTests.cs b/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetUserAuthTypeLayoutRendererTests.cs index 6e070490..5a1279e7 100644 --- a/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetUserAuthTypeLayoutRendererTests.cs +++ b/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetUserAuthTypeLayoutRendererTests.cs @@ -1,5 +1,5 @@ using System.Security.Principal; -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE using System.Web; using System.Web.Routing; using System.Collections.Specialized; diff --git a/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetUserIdentityLayoutRendererTests.cs b/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetUserIdentityLayoutRendererTests.cs index 64f4f3f1..653bd645 100644 --- a/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetUserIdentityLayoutRendererTests.cs +++ b/NLog.Web.AspNetCore.Tests/LayoutRenderers/AspNetUserIdentityLayoutRendererTests.cs @@ -1,5 +1,5 @@ using System.Security.Principal; -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE using System.Web; using System.Web.Routing; using System.Collections.Specialized; diff --git a/NLog.Web.AspNetCore.Tests/LayoutRenderers/TestInvolvingAspNetHttpContext.cs b/NLog.Web.AspNetCore.Tests/LayoutRenderers/TestInvolvingAspNetHttpContext.cs index 8b5dfdee..6adafca9 100644 --- a/NLog.Web.AspNetCore.Tests/LayoutRenderers/TestInvolvingAspNetHttpContext.cs +++ b/NLog.Web.AspNetCore.Tests/LayoutRenderers/TestInvolvingAspNetHttpContext.cs @@ -2,7 +2,7 @@ using System.Collections; using System.IO; using System.Reflection; -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE using System.Web; using System.Web.Routing; using System.Collections.Specialized; @@ -28,7 +28,7 @@ public abstract class TestInvolvingAspNetHttpContext : TestBase, IDisposable protected TestInvolvingAspNetHttpContext() { HttpContext = SetupFakeHttpContext(); -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE HttpContext.Current = HttpContext; #endif } @@ -56,7 +56,7 @@ protected XmlLoggingConfiguration CreateConfigurationFromString(string configXml protected HttpContext SetupFakeHttpContext() { -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE var httpRequest = SetUpHttpRequest(); var stringWriter = new StringWriter(); var httpResponse = new HttpResponse(stringWriter); @@ -65,7 +65,7 @@ protected HttpContext SetupFakeHttpContext() return null; #endif } -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE protected virtual HttpRequest SetUpHttpRequest(string query = "") { return new HttpRequest("", "http://stackoverflow/", query); diff --git a/NLog.Web.AspNetCore.Tests/NLog.Web.AspNetCore.Tests.csproj b/NLog.Web.AspNetCore.Tests/NLog.Web.AspNetCore.Tests.csproj index e9f84f73..00e08517 100644 --- a/NLog.Web.AspNetCore.Tests/NLog.Web.AspNetCore.Tests.csproj +++ b/NLog.Web.AspNetCore.Tests/NLog.Web.AspNetCore.Tests.csproj @@ -2,7 +2,7 @@ net452;netcoreapp1.0 - $(DefineConstants);NETSTANDARD_1plus + $(DefineConstants);ASP_NET_CORE NLog.Web.AspNetCore.Tests 1.2.3.0 diff --git a/NLog.Web.AspNetCore.Tests/TestBase.cs b/NLog.Web.AspNetCore.Tests/TestBase.cs index 6b84dadb..ca20bf13 100644 --- a/NLog.Web.AspNetCore.Tests/TestBase.cs +++ b/NLog.Web.AspNetCore.Tests/TestBase.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; -#if NETSTANDARD_1plus +#if ASP_NET_CORE using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Primitives; #endif @@ -16,7 +16,7 @@ public TestBase() LogManager.ThrowExceptions = true; } -#if NETSTANDARD_1plus +#if ASP_NET_CORE protected class HeaderDict : Dictionary, IHeaderDictionary { /// Initializes a new instance of the class that is empty, has the default initial capacity, and uses the default equality comparer for the key type. @@ -25,7 +25,7 @@ public HeaderDict() } - } + } #endif - } + } } \ No newline at end of file diff --git a/NLog.Web.AspNetCore/DefaultHttpContextAccessor.cs b/NLog.Web.AspNetCore/DefaultHttpContextAccessor.cs index 317c3b66..be82091f 100644 --- a/NLog.Web.AspNetCore/DefaultHttpContextAccessor.cs +++ b/NLog.Web.AspNetCore/DefaultHttpContextAccessor.cs @@ -1,4 +1,4 @@ -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE using System.Web; #else @@ -8,7 +8,7 @@ namespace NLog.Web { -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE /// /// Provides the HttpContext associated with the current request. /// diff --git a/NLog.Web.AspNetCore/IHttpContextAccessor.cs b/NLog.Web.AspNetCore/IHttpContextAccessor.cs index 62e799e5..1de5159e 100644 --- a/NLog.Web.AspNetCore/IHttpContextAccessor.cs +++ b/NLog.Web.AspNetCore/IHttpContextAccessor.cs @@ -1,4 +1,4 @@ -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE using System; using System.Web; diff --git a/NLog.Web.AspNetCore/Internal/PropertyReader.cs b/NLog.Web.AspNetCore/Internal/PropertyReader.cs index dcd35a67..f3521980 100644 --- a/NLog.Web.AspNetCore/Internal/PropertyReader.cs +++ b/NLog.Web.AspNetCore/Internal/PropertyReader.cs @@ -51,7 +51,7 @@ public static object GetValue(string key, Func getVal, bool eval private static PropertyInfo GetPropertyInfo(object value, string propertyName) { -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE return value?.GetType().GetProperty(propertyName); #else return value?.GetType().GetTypeInfo().GetDeclaredProperty(propertyName); diff --git a/NLog.Web.AspNetCore/Internal/RequestAccessorExtension.cs b/NLog.Web.AspNetCore/Internal/RequestAccessorExtension.cs index 5044bd9d..636d2aa0 100644 --- a/NLog.Web.AspNetCore/Internal/RequestAccessorExtension.cs +++ b/NLog.Web.AspNetCore/Internal/RequestAccessorExtension.cs @@ -1,7 +1,7 @@ using System; using System.Text; using NLog.Common; -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE using System.Web; #else using Microsoft.AspNetCore.Http; @@ -13,7 +13,7 @@ namespace NLog.Web.Internal { internal static class RequestAccessor { -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE internal static HttpRequestBase TryGetRequest(this HttpContextBase context) { try diff --git a/NLog.Web.AspNetCore/LayoutRenderers/AspNetApplicationValueLayoutRenderer.cs b/NLog.Web.AspNetCore/LayoutRenderers/AspNetApplicationValueLayoutRenderer.cs index 13568bbd..2475ef58 100644 --- a/NLog.Web.AspNetCore/LayoutRenderers/AspNetApplicationValueLayoutRenderer.cs +++ b/NLog.Web.AspNetCore/LayoutRenderers/AspNetApplicationValueLayoutRenderer.cs @@ -1,4 +1,4 @@ -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE using System; using System.Globalization; diff --git a/NLog.Web.AspNetCore/LayoutRenderers/AspNetEnvironmentLayoutRenderer.cs b/NLog.Web.AspNetCore/LayoutRenderers/AspNetEnvironmentLayoutRenderer.cs index 2356f32d..36e2a5ff 100644 --- a/NLog.Web.AspNetCore/LayoutRenderers/AspNetEnvironmentLayoutRenderer.cs +++ b/NLog.Web.AspNetCore/LayoutRenderers/AspNetEnvironmentLayoutRenderer.cs @@ -1,4 +1,4 @@ -#if NETSTANDARD_1plus +#if ASP_NET_CORE using System; using System.Text; using Microsoft.AspNetCore.Hosting; diff --git a/NLog.Web.AspNetCore/LayoutRenderers/AspNetItemValueLayoutRenderer.cs b/NLog.Web.AspNetCore/LayoutRenderers/AspNetItemValueLayoutRenderer.cs index 7ab9af35..a9114aa5 100644 --- a/NLog.Web.AspNetCore/LayoutRenderers/AspNetItemValueLayoutRenderer.cs +++ b/NLog.Web.AspNetCore/LayoutRenderers/AspNetItemValueLayoutRenderer.cs @@ -2,7 +2,7 @@ using System.Globalization; using System.Linq; using System.Text; -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE using System.Web; #else #endif diff --git a/NLog.Web.AspNetCore/LayoutRenderers/AspNetLayoutRendererBase.cs b/NLog.Web.AspNetCore/LayoutRenderers/AspNetLayoutRendererBase.cs index 4411e096..4bc4a720 100644 --- a/NLog.Web.AspNetCore/LayoutRenderers/AspNetLayoutRendererBase.cs +++ b/NLog.Web.AspNetCore/LayoutRenderers/AspNetLayoutRendererBase.cs @@ -3,7 +3,7 @@ using System.Linq; using System.Text; using NLog.LayoutRenderers; -#if NETSTANDARD_1plus +#if ASP_NET_CORE using NLog.Web.Internal; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.DependencyInjection; @@ -21,13 +21,13 @@ public abstract class AspNetLayoutRendererBase : LayoutRenderer /// protected AspNetLayoutRendererBase() { -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE HttpContextAccessor = new DefaultHttpContextAccessor(); #endif } -#if NETSTANDARD_1plus +#if ASP_NET_CORE /// /// Context for DI @@ -85,7 +85,7 @@ protected override void Append(StringBuilder builder, LogEventInfo logEvent) /// Logging event. protected abstract void DoAppend(StringBuilder builder, LogEventInfo logEvent); -#if NETSTANDARD_1plus +#if ASP_NET_CORE /// protected override void CloseLayoutRenderer() diff --git a/NLog.Web.AspNetCore/LayoutRenderers/AspNetMvcActionRenderer.cs b/NLog.Web.AspNetCore/LayoutRenderers/AspNetMvcActionRenderer.cs index 521b128f..ef00fe2c 100644 --- a/NLog.Web.AspNetCore/LayoutRenderers/AspNetMvcActionRenderer.cs +++ b/NLog.Web.AspNetCore/LayoutRenderers/AspNetMvcActionRenderer.cs @@ -1,6 +1,6 @@ using NLog.LayoutRenderers; using System.Text; -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE using System.Web.Routing; using System.Web; #else @@ -36,7 +36,7 @@ protected override void MvcDoAppend(StringBuilder builder, LogEventInfo logEvent string key = "action"; string controller; -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE controller = RouteTable.Routes?.GetRouteData(context)?.Values[key]?.ToString(); #else controller = context?.GetRouteData()?.Values?[key]?.ToString(); diff --git a/NLog.Web.AspNetCore/LayoutRenderers/AspNetMvcControllerRenderer.cs b/NLog.Web.AspNetCore/LayoutRenderers/AspNetMvcControllerRenderer.cs index 02be138b..2298cb97 100644 --- a/NLog.Web.AspNetCore/LayoutRenderers/AspNetMvcControllerRenderer.cs +++ b/NLog.Web.AspNetCore/LayoutRenderers/AspNetMvcControllerRenderer.cs @@ -1,6 +1,6 @@ using NLog.LayoutRenderers; using System.Text; -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE using System.Web.Routing; using System.Web; #else @@ -37,7 +37,7 @@ protected override void MvcDoAppend(StringBuilder builder, LogEventInfo logEvent string key = "controller"; string controller; -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE controller = RouteTable.Routes?.GetRouteData(context)?.Values[key]?.ToString(); #else controller = context?.GetRouteData()?.Values?[key]?.ToString(); diff --git a/NLog.Web.AspNetCore/LayoutRenderers/AspNetMvcLayoutRendererBase.cs b/NLog.Web.AspNetCore/LayoutRenderers/AspNetMvcLayoutRendererBase.cs index f97e5e3b..26328830 100644 --- a/NLog.Web.AspNetCore/LayoutRenderers/AspNetMvcLayoutRendererBase.cs +++ b/NLog.Web.AspNetCore/LayoutRenderers/AspNetMvcLayoutRendererBase.cs @@ -1,7 +1,7 @@ using NLog.LayoutRenderers; using System.Text; using System; -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE using NLog.Web.Internal; using System.Web.Routing; using System.Web; diff --git a/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestContentTypeLayoutRenderer.cs b/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestContentTypeLayoutRenderer.cs index 3597384a..0cf4253b 100644 --- a/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestContentTypeLayoutRenderer.cs +++ b/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestContentTypeLayoutRenderer.cs @@ -1,4 +1,4 @@ -#if NETSTANDARD_1plus +#if ASP_NET_CORE using NLog.LayoutRenderers; using System.Text; diff --git a/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestCookieLayoutRenderer.cs b/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestCookieLayoutRenderer.cs index 66bb4c0b..49d9fb7c 100644 --- a/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestCookieLayoutRenderer.cs +++ b/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestCookieLayoutRenderer.cs @@ -1,5 +1,5 @@ using System.Text; -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE using System.Collections.Specialized; using System.Web; #else @@ -59,7 +59,7 @@ protected override void DoAppend(StringBuilder builder, LogEventInfo logEvent) } -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE private IEnumerable> GetCookies(HttpCookieCollection cookies) { diff --git a/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestHostLayoutRenderer.cs b/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestHostLayoutRenderer.cs index 9456380f..b1682c65 100644 --- a/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestHostLayoutRenderer.cs +++ b/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestHostLayoutRenderer.cs @@ -1,7 +1,7 @@ using NLog.LayoutRenderers; using System.Text; -#if NETSTANDARD_1plus +#if ASP_NET_CORE using Microsoft.AspNetCore.Routing; #endif using NLog.Web.Internal; @@ -30,7 +30,7 @@ public class AspNetRequestHostLayoutRenderer : AspNetLayoutRendererBase protected override void DoAppend(StringBuilder builder, LogEventInfo logEvent) { var request = HttpContextAccessor?.HttpContext?.TryGetRequest(); -#if NETSTANDARD_1plus +#if ASP_NET_CORE var host = request?.Host; #else var host = request?.UserHostName; diff --git a/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestHttpMethodRenderer.cs b/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestHttpMethodRenderer.cs index 1b939b08..055dea26 100644 --- a/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestHttpMethodRenderer.cs +++ b/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestHttpMethodRenderer.cs @@ -1,5 +1,5 @@ using System.Text; -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE using System.Web; using System.Collections.Specialized; #endif @@ -36,7 +36,7 @@ protected override void DoAppend(StringBuilder builder, LogEventInfo logEvent) return; string httpMethod; -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE httpMethod = httpRequest.HttpMethod; #else httpMethod = httpRequest.Method; diff --git a/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestIpLayoutRenderer.cs b/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestIpLayoutRenderer.cs index f4093ee4..6e743a16 100644 --- a/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestIpLayoutRenderer.cs +++ b/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestIpLayoutRenderer.cs @@ -1,6 +1,6 @@ using System; using System.Text; -#if NETSTANDARD_1plus +#if ASP_NET_CORE using Microsoft.AspNetCore.Http; #endif using NLog.Config; @@ -30,7 +30,7 @@ protected override void DoAppend(StringBuilder builder, LogEventInfo logEvent) { return; } -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE var ip = httpContext.Request?.ServerVariables["REMOTE_ADDR"]; #else diff --git a/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestQueryStringLayoutRenderer.cs b/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestQueryStringLayoutRenderer.cs index a1c65787..519e8264 100644 --- a/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestQueryStringLayoutRenderer.cs +++ b/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestQueryStringLayoutRenderer.cs @@ -1,5 +1,5 @@ using System.Text; -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE using System.Web; using System.Collections.Specialized; #else @@ -50,7 +50,7 @@ protected override void DoAppend(StringBuilder builder, LogEventInfo logEvent) var printAllQueryString = this.QueryStringKeys == null || this.QueryStringKeys.Count == 0; var queryStringKeys = this.QueryStringKeys; -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE var queryStrings = httpRequest.QueryString; if (queryStrings == null) @@ -86,7 +86,7 @@ protected override void DoAppend(StringBuilder builder, LogEventInfo logEvent) } private static IEnumerable> GetValues( -#if NETSTANDARD_1plus +#if ASP_NET_CORE IQueryCollection queryStrings, #else NameValueCollection queryStrings, @@ -99,7 +99,7 @@ private static IEnumerable> GetValues( foreach (var key in queryStringKeys) { // This platoform specific code is to prevent an unncessary .ToString call otherwise. -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE var value = queryStrings[key]; #else var value = queryStrings[key].ToString(); diff --git a/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestReferrerRenderer.cs b/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestReferrerRenderer.cs index e4afccb9..f6b8a1a7 100644 --- a/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestReferrerRenderer.cs +++ b/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestReferrerRenderer.cs @@ -1,5 +1,5 @@ using System.Text; -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE using System.Web; using System.Collections.Specialized; #endif @@ -37,7 +37,7 @@ protected override void DoAppend(StringBuilder builder, LogEventInfo logEvent) string referrer; -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE referrer = httpRequest.UrlReferrer?.ToString(); #else referrer = httpRequest.Headers["Referer"].ToString(); diff --git a/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestUrlRenderer.cs b/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestUrlRenderer.cs index ec33ca2e..957f7af2 100644 --- a/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestUrlRenderer.cs +++ b/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestUrlRenderer.cs @@ -1,5 +1,5 @@ using System.Text; -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE using System.Web; using System.Collections.Specialized; #else @@ -65,7 +65,7 @@ protected override void DoAppend(StringBuilder builder, LogEventInfo logEvent) string url, pathAndQuery, port, host, scheme; url = pathAndQuery = port = host = scheme = null; -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE if (httpRequest.Url == null) { diff --git a/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestValueLayoutRenderer.cs b/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestValueLayoutRenderer.cs index 2ee886a0..6e75fa40 100644 --- a/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestValueLayoutRenderer.cs +++ b/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestValueLayoutRenderer.cs @@ -1,6 +1,6 @@ using System; using System.Text; -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE using NLog.Common; using System.Web; #else @@ -58,7 +58,7 @@ public class AspNetRequestValueLayoutRenderer : AspNetLayoutRendererBase /// public string Cookie { get; set; } -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE //missing in .NET Core (RC2) @@ -91,7 +91,7 @@ protected override void DoAppend(StringBuilder builder, LogEventInfo logEvent) if (this.QueryString != null) { -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE if (httpRequest.QueryString != null) { builder.Append(httpRequest.QueryString[this.QueryString]); @@ -109,7 +109,7 @@ protected override void DoAppend(StringBuilder builder, LogEventInfo logEvent) } else if (this.Cookie != null && httpRequest.Cookies != null) { -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE var cookie = httpRequest.Cookies[this.Cookie]; if (cookie != null) @@ -122,7 +122,7 @@ protected override void DoAppend(StringBuilder builder, LogEventInfo logEvent) #endif } -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE else if (this.ServerVariable != null && httpRequest.ServerVariables != null) { builder.Append(httpRequest.ServerVariables[this.ServerVariable]); @@ -139,7 +139,7 @@ protected override void DoAppend(StringBuilder builder, LogEventInfo logEvent) } else if (this.Item != null) { -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE builder.Append(httpRequest[this.Item]); #else builder.Append(httpRequest.HttpContext.Items[this.Item]); diff --git a/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestuseragent.cs b/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestuseragent.cs index 570024f9..da8c9540 100644 --- a/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestuseragent.cs +++ b/NLog.Web.AspNetCore/LayoutRenderers/AspNetRequestuseragent.cs @@ -1,5 +1,5 @@ using System.Text; -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE using System.Web; using System.Collections.Specialized; #endif @@ -36,7 +36,7 @@ protected override void DoAppend(StringBuilder builder, LogEventInfo logEvent) return; string userAgent = string.Empty; -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE userAgent = httpRequest.UserAgent; #else diff --git a/NLog.Web.AspNetCore/LayoutRenderers/AspNetSessionIdLayoutRenderer.cs b/NLog.Web.AspNetCore/LayoutRenderers/AspNetSessionIdLayoutRenderer.cs index fc0829ee..38505e6d 100644 --- a/NLog.Web.AspNetCore/LayoutRenderers/AspNetSessionIdLayoutRenderer.cs +++ b/NLog.Web.AspNetCore/LayoutRenderers/AspNetSessionIdLayoutRenderer.cs @@ -1,5 +1,5 @@ using System.Text; -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE using System.Web; #else @@ -27,7 +27,7 @@ protected override void DoAppend(StringBuilder builder, LogEventInfo logEvent) { return; } -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE builder.Append(context.Session.SessionID); #else builder.Append(context.Session.Id); diff --git a/NLog.Web.AspNetCore/LayoutRenderers/AspNetSessionValueLayoutRenderer.cs b/NLog.Web.AspNetCore/LayoutRenderers/AspNetSessionValueLayoutRenderer.cs index ad439671..d50dc77f 100644 --- a/NLog.Web.AspNetCore/LayoutRenderers/AspNetSessionValueLayoutRenderer.cs +++ b/NLog.Web.AspNetCore/LayoutRenderers/AspNetSessionValueLayoutRenderer.cs @@ -3,7 +3,7 @@ using System.Linq; using System.Text; using NLog.Common; -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE using System.Web; #else using Microsoft.AspNetCore.Http.Features; @@ -88,7 +88,7 @@ protected override void DoAppend(StringBuilder builder, LogEventInfo logEvent) { return; } -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE var value = PropertyReader.GetValue(Variable, k => context.Session[k], EvaluateAsNestedProperties); #else if (context.Items == null) diff --git a/NLog.Web.AspNetCore/LayoutRenderers/AspNetUserAuthTypeLayoutRenderer.cs b/NLog.Web.AspNetCore/LayoutRenderers/AspNetUserAuthTypeLayoutRenderer.cs index e4fbbf73..b20068da 100644 --- a/NLog.Web.AspNetCore/LayoutRenderers/AspNetUserAuthTypeLayoutRenderer.cs +++ b/NLog.Web.AspNetCore/LayoutRenderers/AspNetUserAuthTypeLayoutRenderer.cs @@ -1,6 +1,6 @@ using System; using System.Text; -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE using System.Web; #else #endif diff --git a/NLog.Web.AspNetCore/LayoutRenderers/AspNetUserIdentityLayoutRenderer.cs b/NLog.Web.AspNetCore/LayoutRenderers/AspNetUserIdentityLayoutRenderer.cs index 3e98cceb..0dfc078c 100644 --- a/NLog.Web.AspNetCore/LayoutRenderers/AspNetUserIdentityLayoutRenderer.cs +++ b/NLog.Web.AspNetCore/LayoutRenderers/AspNetUserIdentityLayoutRenderer.cs @@ -1,6 +1,6 @@ using System; using System.Text; -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE using System.Web; #else #endif diff --git a/NLog.Web.AspNetCore/LayoutRenderers/AssemblyVersionLayoutRenderer.cs b/NLog.Web.AspNetCore/LayoutRenderers/AssemblyVersionLayoutRenderer.cs index 77525f30..57482dae 100644 --- a/NLog.Web.AspNetCore/LayoutRenderers/AssemblyVersionLayoutRenderer.cs +++ b/NLog.Web.AspNetCore/LayoutRenderers/AssemblyVersionLayoutRenderer.cs @@ -7,10 +7,13 @@ using NLog.Config; using NLog.LayoutRenderers; -#if NETSTANDARD_1plus +#if ASP_NET_CORE using System.Threading.Tasks; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; +#endif + +#if ASP_NET_CORE using Microsoft.Extensions.PlatformAbstractions; #endif @@ -58,7 +61,7 @@ protected override void Append(StringBuilder builder, LogEventInfo logEvent) { //try entry assembly -#if NETSTANDARD_1plus +#if ASP_NET_CORE string assemblyVersion = PlatformServices.Default.Application.RuntimeFramework.Version.ToString(); builder.Append(assemblyVersion); @@ -79,12 +82,12 @@ protected override void Append(StringBuilder builder, LogEventInfo logEvent) builder.Append(assembly.GetName().Version.ToString()); } #endif - + } } -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE private static Assembly GetAspNetEntryAssembly() { if (System.Web.HttpContext.Current == null || System.Web.HttpContext.Current.ApplicationInstance == null) diff --git a/NLog.Web.AspNetCore/LayoutRenderers/IISInstanceNameLayoutRenderer.cs b/NLog.Web.AspNetCore/LayoutRenderers/IISInstanceNameLayoutRenderer.cs index 56d21bb4..14b36431 100644 --- a/NLog.Web.AspNetCore/LayoutRenderers/IISInstanceNameLayoutRenderer.cs +++ b/NLog.Web.AspNetCore/LayoutRenderers/IISInstanceNameLayoutRenderer.cs @@ -1,6 +1,6 @@ using System; using System.Text; -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE using System.Web.Hosting; #else using Microsoft.AspNetCore.Hosting; @@ -12,7 +12,7 @@ namespace NLog.Web.LayoutRenderers { -#if NETSTANDARD_1plus +#if ASP_NET_CORE /// /// Rendering site name in IIS. /// @@ -25,7 +25,7 @@ namespace NLog.Web.LayoutRenderers // ReSharper disable once InconsistentNaming public class IISInstanceNameLayoutRenderer : LayoutRenderer { -#if NETSTANDARD_1plus +#if ASP_NET_CORE private static IHostingEnvironment _hostingEnvironment; private static IHostingEnvironment HostingEnvironment => _hostingEnvironment ?? (_hostingEnvironment = ServiceLocator.ServiceProvider?.GetService()); @@ -40,7 +40,7 @@ protected override void Append(StringBuilder builder, LogEventInfo logEvent) { -#if NETSTANDARD_1plus +#if ASP_NET_CORE builder.Append(HostingEnvironment?.ApplicationName); #else @@ -48,7 +48,7 @@ protected override void Append(StringBuilder builder, LogEventInfo logEvent) #endif } -#if NETSTANDARD_1plus +#if ASP_NET_CORE /// protected override void CloseLayoutRenderer() diff --git a/NLog.Web.AspNetCore/NLog.Web.AspNetCore.csproj b/NLog.Web.AspNetCore/NLog.Web.AspNetCore.csproj index 862d4115..cdaf7c56 100644 --- a/NLog.Web.AspNetCore/NLog.Web.AspNetCore.csproj +++ b/NLog.Web.AspNetCore/NLog.Web.AspNetCore.csproj @@ -6,7 +6,7 @@ 4.3.2 Julian Verdurmen netstandard1.3;net451 - $(DefineConstants);NETSTANDARD_1plus + $(DefineConstants);ASP_NET_CORE true NLog.Web.AspNetCore NLog.snk @@ -37,7 +37,7 @@ - + @@ -47,5 +47,5 @@ - + diff --git a/NLog.Web.AspNetCore/NLogHttpModule.cs b/NLog.Web.AspNetCore/NLogHttpModule.cs index fa608e3c..5419812b 100644 --- a/NLog.Web.AspNetCore/NLogHttpModule.cs +++ b/NLog.Web.AspNetCore/NLogHttpModule.cs @@ -1,4 +1,4 @@ -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE using System; using System.Web; diff --git a/NLog.Web.AspNetCore/Targets/AspNetTrace.cs b/NLog.Web.AspNetCore/Targets/AspNetTrace.cs index 408c1513..46c40479 100644 --- a/NLog.Web.AspNetCore/Targets/AspNetTrace.cs +++ b/NLog.Web.AspNetCore/Targets/AspNetTrace.cs @@ -1,5 +1,5 @@  -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE using System.Web; using NLog.Targets; diff --git a/NLog.Web.AspNetCore/Targets/Wrappers/AspNetBufferingTargetWrapper.cs b/NLog.Web.AspNetCore/Targets/Wrappers/AspNetBufferingTargetWrapper.cs index 9060b927..0d457a0a 100644 --- a/NLog.Web.AspNetCore/Targets/Wrappers/AspNetBufferingTargetWrapper.cs +++ b/NLog.Web.AspNetCore/Targets/Wrappers/AspNetBufferingTargetWrapper.cs @@ -1,4 +1,4 @@ -#if !NETSTANDARD_1plus +#if !ASP_NET_CORE using System; using System.ComponentModel; using System.Web;