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

and don't forget to add

using NLog.Extensions.Logging;

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