Skip to content

System.IO.FileNotFoundException: 'Could not load file or assembly 'Serlolg.Sinks.Console, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.' #454

@dca00

Description

@dca00

Serilog packages are installed in my project:

Image

They create these dependencies, console being one of them:

Image

Configuration in appsettings.json:

  "SeriLog": {
    "Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.File" ],
    "MinimumLevel": {
      "Default": "Debug",
      "Override": {
      }
    },
    "WriteTo": [
      {
        "Name": "Console",
        "Args": {
          "theme": "Serilog.Sinks.SystemConsole.Themes.AnsiConsoleTheme::Code, Serlolg.Sinks.Console",
          "outputTemplate": "[{Timestamp:HH:mm:ss} {SourceContext} {Level}] {Message}{NewLine}{Exception}",
        }
      },
      {
        "Name": "File",
        "Args": {
          "path": "C:/1/project.log",
          "rollingInterval": "Day",
          "outputTemplate": "[{Timestamp:HH:mm:ss} {SourceContext} {Level}] {Message}{NewLine}{Exception}",
          "formatter": {
            "type": "Serilog.Formatting.Compact.CompactJsonFormatter, Serilog.Formatting.Compact"
          }
        }
      }
    ],
    "Enrich": [
      "FromLogContext",
      "WithMachineName",
      "WithThreadId",
      "WithExceptionDetails"
    ],

When this application creates its logger:

var logger = new LoggerConfiguration().ReadFrom.Configuration(cfg).CreateLogger();

this error is thrown:

System.IO.FileNotFoundException: 'Could not load file or assembly 'Serlolg.Sinks.Console, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.'

Technically, it is true: there is no such file:

Image

I uninstalled and reinstalled Serilog.Sinks.Console but the error is still there.

I saw a similar issue #407 closed, but I cannot follow the same pattern as my organization blocks stack exchange, and I won't be able to either create a question there or see any answers, so please let this stay here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions