How to fix 'ILoggingBuilder' does not contain a definition for 'AddNLog'
By FoxLearn 2/18/2024 9:27:36 AM 55
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) => { logging.AddConfiguration(hostingContext.Configuration.GetSection("Logging")); logging.AddDebug(); logging.AddNLog(); }).ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup<Startup>(); });
Right-clicking on your project, then select Manage Nuget Packages => Search 'NLog.Extensions.Logging' => Install it to your project.
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.
Categories
Popular Posts
Visual Studio: Auto increment version
04/01/2024
What is ARM architecture?
04/01/2024