Skip to content

NET Framework v4.6.2 with NET8 nuget-dependencies #797

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions src/NLog.Extensions.Hosting/Extensions/ConfigureExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
using Microsoft.Extensions.Hosting;
using NLog.Config;
using NLog.Extensions.Logging;
#if NETSTANDARD2_0
using IHostEnvironment = Microsoft.Extensions.Hosting.IHostingEnvironment;
#endif

namespace NLog.Extensions.Hosting
{
Expand Down Expand Up @@ -36,11 +33,7 @@ public static IHostBuilder UseNLog(this IHostBuilder builder)
public static IHostBuilder UseNLog(this IHostBuilder builder, NLogProviderOptions? options)
{
Guard.ThrowIfNull(builder);
#if NETSTANDARD2_0
builder.ConfigureServices((builderContext, services) => AddNLogLoggerProvider(services, builderContext.Configuration, null, options, CreateNLogLoggerProvider));
#else
builder.ConfigureServices((builderContext, services) => AddNLogLoggerProvider(services, builderContext.Configuration, builderContext.HostingEnvironment, options, CreateNLogLoggerProvider));
#endif
return builder;
}

Expand All @@ -54,11 +47,7 @@ public static IHostBuilder UseNLog(this IHostBuilder builder, NLogProviderOption
public static IHostBuilder UseNLog(this IHostBuilder builder, NLogProviderOptions options, Func<IServiceProvider, LogFactory> factoryBuilder)
{
Guard.ThrowIfNull(builder);
#if NETSTANDARD2_0
builder.ConfigureServices((builderContext, services) => AddNLogLoggerProvider(services, builderContext.Configuration, null, options, (serviceProvider, config, hostEnv, opt) =>
#else
builder.ConfigureServices((builderContext, services) => AddNLogLoggerProvider(services, builderContext.Configuration, builderContext.HostingEnvironment, options, (serviceProvider, config, hostEnv, opt) =>
#endif
{
RegisterHostNLogExtensions(LogManager.LogFactory, serviceProvider, hostEnv);
config = serviceProvider.SetupNLogConfigSettings(config, LogManager.LogFactory);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
using NLog.Config;
using NLog.LayoutRenderers;

#if NETSTANDARD2_0
using IHostEnvironment = Microsoft.Extensions.Hosting.IHostingEnvironment;
#endif

namespace NLog.Extensions.Hosting
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
using NLog.Config;
using NLog.LayoutRenderers;

#if NETSTANDARD2_0
using IHostEnvironment = Microsoft.Extensions.Hosting.IHostingEnvironment;
#endif

namespace NLog.Extensions.Hosting
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
using NLog.Config;
using NLog.LayoutRenderers;

#if NETSTANDARD2_0
using IHostEnvironment = Microsoft.Extensions.Hosting.IHostingEnvironment;
#endif

namespace Microsoft.Extensions.Hosting
{
/// <summary>
Expand Down
4 changes: 1 addition & 3 deletions src/NLog.Extensions.Hosting/NLog.Extensions.Hosting.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,10 @@ For ASP.NET Core, check: https://www.nuget.org/packages/NLog.Web.AspNetCore

<ItemGroup Condition=" '$(TargetFramework)' == 'net462' ">
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.1' ">
Expand Down
19 changes: 10 additions & 9 deletions src/NLog.Extensions.Logging/NLog.Extensions.Logging.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net461;netstandard2.0;netstandard2.1;net6.0;net8.0</TargetFrameworks>
<TargetFrameworks>net462;netstandard2.0;netstandard2.1;net6.0;net8.0</TargetFrameworks>
<DebugType Condition=" '$(Configuration)' == 'Debug' ">Full</DebugType>

<Product>NLog.Extensions.Logging v$(ProductVersion)</Product>
Expand All @@ -20,6 +20,7 @@ ChangeLog:

- Updated to NLog v6.0-RC4
- Removed support for NetStandard 1.3 + 1.5
- Replaced .NET Framework v4.6.1 with v4.6.2 and NET8-nuget-dependencies.
- Enabled nullable references
- Avoid boxing when extracting LogEvent properties from struct
- Reduce allocation when creating LogEvent with properties by using ReadOnlySpan
Expand Down Expand Up @@ -53,14 +54,14 @@ List of major changes in NLog 6.0: https://nlog-project.org/2025/04/29/nlog-6-0-
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Nullable>enable</Nullable>
<LangVersion>9</LangVersion>
<LangVersion Condition=" '$(TargetFramework)' != 'net461' AND '$(TargetFramework)' != 'netstandard2.0' ">12</LangVersion>
<LangVersion Condition=" '$(TargetFramework)' != 'net462' AND '$(TargetFramework)' != 'netstandard2.0' ">12</LangVersion>
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
<IsTrimmable Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0'))">true</IsTrimmable>
<IsAotCompatible Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net7.0'))">true</IsAotCompatible>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'net461' ">
<Title>NLog.Extensions.Logging for .NET Framework 4.6.1</Title>
<PropertyGroup Condition=" '$(TargetFramework)' == 'net462' ">
<Title>NLog.Extensions.Logging for .NET Framework 4.6.2</Title>
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
Expand All @@ -83,14 +84,14 @@ List of major changes in NLog 6.0: https://nlog-project.org/2025/04/29/nlog-6-0-
<PackageReference Include="NLog" Version="6.0.0-rc4" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="2.1.0" />
<ItemGroup Condition=" '$(TargetFramework)' == 'net462' ">
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
<Reference Include="System" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.1' ">
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
Expand Down