CS1929 C# ‘ILoggerFactory’ does not contain a definition for and the best extension method overload requires a receiver of type

This error pops up pretty frequently when upgrading your .net core project to 3.0 or 3.1.

The solution apparently is to replace the old code:

private ILoggerFactory ConfigureLogging(ILoggerFactory factory)
{
      factory.AddConsole();
      return factory;
}

With this new version:

private IServiceCollection ConfigureLogging(IServiceCollection factory)
{
      factory.AddLogging(opt =>
      {
          opt.AddConsole();
      })
      return factory;
}