System.IO.FileLoadException: 'Could not load file or assembly 'Serilog'

2.1k views Asked by At

Why I get

System.IO.FileLoadException: 'Could not load file or assembly 'Serilog, Version=1.5.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10' or one of its dependencies.

When I try to load this assembly from out side project.

enter image description here


The folloing method is exist in a separate class library project, and I add reference of that dll to my MVC project.

public class LoggingConfig
    {
        public static void RegisterLog()
        {
            const string template = "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level}] {Indent:l}{Message}{NewLine}{Exception}";
            var logger = new LoggerConfiguration()
                         .MinimumLevel.Debug()
                         .WriteTo.Seq("http://localhost:657")
                         .CreateLogger();

            // Configure PostSharp Logging to use Serilog
            LoggingServices.DefaultBackend = new SerilogLoggingBackend(logger);
        }


    }
0

There are 0 answers