Skip to content

Commit

Permalink
Fixed MissingMethodException for HostBuilderContext.get_HostingEnviro…
Browse files Browse the repository at this point in the history
…nment() (#599)
  • Loading branch information
snakefoot authored Jun 23, 2022
1 parent ee17a8e commit 40028b8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/NLog.Extensions.Hosting/Extensions/ConfigureExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ public static IHostBuilder UseNLog(this IHostBuilder builder)
public static IHostBuilder UseNLog(this IHostBuilder builder, NLogProviderOptions options)
{
if (builder == null) throw new ArgumentNullException(nameof(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 Down

0 comments on commit 40028b8

Please sign in to comment.