How to fix 'ILoggingBuilder' does not contain a definition for 'AddNLog'

This post shows you How to fix 'ILoggingBuilder' does not contain a definition for 'AddNLog' and no extension method 'AddNLog' accepting a first argument of type 'ILoggingBuilder'.
public static IHostBuilder CreateHostBuilder(string[] args) =>
    Host.CreateDefaultBuilder(args).ConfigureLogging((hostingContext, logging) =>
    }).ConfigureWebHostDefaults(webBuilder =>

Right-clicking on your project, then select Manage Nuget Packages => Search 'NLog.Extensions.Logging' => Install it to your project.

nlog extensions logging

Next, Add NLog.Extensions.Logging to your class

using NLog.Extensions.Logging;

 hope so you can solve this issue by installing the Nuget Package called NLog.Extensions.Logging, it has a dependency of NLog.