Unable to resolve service for type 'Microsoft.Extensions.Logging.ILogger' while attempting to activate 'xxxx'.
Unable to resolve service for type 'Microsoft.Extensions.Logging.ILogger' while attempting to activate 'xxxx'.
构造注入时需要加入类名
public class DeviceStateCommand : IAsyncCommand<DeviceCommunicationPackageInfo> { private readonly ILogger _logger; public DeviceStateCommand(ILogger<DeviceStateCommand> logger) { _logger = logger; } }