Skip to content

Commit

Permalink
Merge pull request #223 from NLog/net461
Browse files Browse the repository at this point in the history
.NET 4.6.1 + ASP.NET Core 2 support
  • Loading branch information
304NotModified authored Dec 1, 2017
2 parents 6265c40 + 3cdae81 commit 66f8723
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 34 deletions.
31 changes: 21 additions & 10 deletions NLog.Web.AspNetCore.Tests/NLog.Web.AspNetCore.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,33 +1,44 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp1.1;netcoreapp2.0;net461</TargetFrameworks>
<DefineConstants>$(DefineConstants);ASP_NET_CORE</DefineConstants>
<TargetFrameworks>netcoreapp1.1;netcoreapp2;net461</TargetFrameworks>
<AssemblyName>NLog.Web.AspNetCore.Tests</AssemblyName>
<AssemblyVersion>1.2.3.0</AssemblyVersion>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.1' ">

<DefineConstants>$(DefineConstants);ASP_NET_CORE;ASP_NET_CORE1</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' != 'netcoreapp1.1' ">
<RuntimeFrameworkVersion>2.0.0</RuntimeFrameworkVersion>
<DefineConstants>$(DefineConstants);ASP_NET_CORE;ASP_NET_CORE2</DefineConstants>
</PropertyGroup>



<ItemGroup>
<ProjectReference Include="..\NLog.Web.AspNetCore\NLog.Web.AspNetCore.csproj" />
<PackageReference Include="NSubstitute" Version="2.0.3" />
<PackageReference Include="Castle.Core" Version="4.2.0" />
<PackageReference Include="Castle.Core" Version="4.2.1" />
<!-- Castle.Core upgrade for NSubstitute-->

<PackageReference Include="System.Runtime.InteropServices" Version="4.3.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.0-beta5-build3769" />
<PackageReference Include="xunit" Version="2.3.0-beta5-build3769" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
<!--
icrosoft.NET.Test.Sdk needed for xunit.runner.visualstudio
-->
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.0-beta5-build3769" />
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' != 'netcoreapp2.0' ">
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.1' ">
<PackageReference Include="Microsoft.AspNetCore.Http" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Http.Extensions" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Routing.Abstractions" Version="1.1.1" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">
<PackageReference Include="Microsoft.AspNetCore" Version="2.0.0" />
<ItemGroup Condition=" '$(TargetFramework)' != 'netcoreapp1.1' ">
<PackageReference Include="Microsoft.AspNetCore" Version="2.0.1" />
</ItemGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
Expand Down
2 changes: 1 addition & 1 deletion NLog.Web.AspNetCore.Tests/TestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public HeaderDict()



#if NETCOREAPP2_0
#if ASP_NET_CORE2
/// <summary>
/// Strongly typed access to the Content-Length header. Implementations must keep this in sync with the string representation.
/// </summary>
Expand Down
6 changes: 3 additions & 3 deletions NLog.Web.AspNetCore/AspNetExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -27,7 +27,7 @@ public static class AspNetExtensions
/// Enable NLog Web for ASP.NET Core.
/// </summary>
/// <param name="app"></param>
#if NETSTANDARD2_0
#if ASP_NET_CORE2
[Obsolete("Use UseNLog() on IWebHostBuilder")]
#endif
public static void AddNLogWeb(this IApplicationBuilder app)
Expand Down Expand Up @@ -60,7 +60,7 @@ private static LoggingConfiguration ConfigureNLog(string fileName)
}


#if NETSTANDARD2_0
#if ASP_NET_CORE2

/// <summary>
/// Apply NLog configuration from XML config.
Expand Down
33 changes: 15 additions & 18 deletions NLog.Web.AspNetCore/NLog.Web.AspNetCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
<AssemblyTitle>NLog.Web.AspNetCore</AssemblyTitle>

<Authors>Julian Verdurmen</Authors>
<TargetFrameworks>netstandard1.3;netstandard1.5;net451;netstandard2.0</TargetFrameworks>
<DefineConstants>$(DefineConstants);ASP_NET_CORE</DefineConstants>
<TargetFrameworks>netstandard1.3;netstandard1.5;net451;net461;netstandard2.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AssemblyName>NLog.Web.AspNetCore</AssemblyName>
<AssemblyOriginatorKeyFile>NLog.snk</AssemblyOriginatorKeyFile>
Expand Down Expand Up @@ -51,41 +50,39 @@
<RootNamespace>NLog.Web</RootNamespace>
</PropertyGroup>

<ItemGroup>


<PropertyGroup Condition=" '$(TargetFramework)' != 'netstandard2.0' and '$(TargetFramework)' != 'net461' ">
<DefineConstants>$(DefineConstants);ASP_NET_CORE;ASP_NET_CORE1</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'net461' ">
<DefineConstants>$(DefineConstants);ASP_NET_CORE;ASP_NET_CORE2</DefineConstants>
</PropertyGroup>

<PackageReference Include="NLog.Extensions.Logging" Version="1.0.0-rtm-rc2" />
<ItemGroup>
<PackageReference Include="NLog.Extensions.Logging" Version="1.0.0-rtm-rc3" />
<PackageReference Include="System.ValueTuple" Version="4.3.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' != 'netstandard2.0' ">

<ItemGroup Condition=" '$(TargetFramework)' != 'netstandard2.0' and '$(TargetFramework)' != 'net461' ">
<PackageReference Include="Microsoft.AspNetCore.Http" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Http.Extensions" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Routing.Abstractions" Version="1.1.1" />

</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.3' ">
<PackageReference Include="Microsoft.Extensions.PlatformAbstractions" Version="1.0.0" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'net461' ">
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Http.Extensions" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Routing.Abstractions" Version="2.0.0" />


</ItemGroup>
<ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.3' ">
<PackageReference Include="Microsoft.Extensions.PlatformAbstractions" Version="1.0.0" />
</ItemGroup>




</Project>
3 changes: 1 addition & 2 deletions NLog.Web.AspNetCore/NLogBuilder.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#if NETSTANDARD2_0

#if ASP_NET_CORE2

using System;
using System.Collections.Generic;
Expand Down

0 comments on commit 66f8723

Please sign in to comment.