private ILoggerFactory ConfigureLogging(ILoggerFactory factory)
{
factory.AddConsole();
return factory;
}
我已经在Github上找到了上面的代码。它给出以下错误:
'ILoggerFactory' does not contain a definition for 'AddConsole' and the best extension method overload 'ConsoleLoggerExtensions.AddConsole(ILoggingBuilder)' requires a receiver of type 'ILoggingBuilder'
我正在使用NET Core 3.0,并且安装了以下NuGet软件包。
<PackageReference Include="Discord.Net" Version="2.1.1" />
<PackageReference Include="Discord.Net.Commands" Version="2.1.1" />
<PackageReference Include="Discord.Net.WebSocket" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="3.0.0" />
为什么我得到那个ILoggerFactory
没有方法AddConsole()
?我怎样才能解决这个问题?
如何修复过时的ILoggerFactory方法的
—
golobich
我的问题可能很愚蠢,但是您是否检查过
—
Romain Reboulleau
AddConsole
方法声明中是否包含方法定义using
?