Results 1 to 2 of 2

Thread: What namspace and I missing for Serilog?

  1. #1
    Join Date
    Aug 2012
    Posts
    10

    What namspace and I missing for Serilog?

    What namspace and I missing for Serilog?

    I am able to use LoggerConfiguration() in my C# code with various Serilog Sinks but my compiler is complaining about the specification of my use of ".WriteTo.File". I am confused because I have ben able to use this specification in another demo solution. I wonder if there is some sort of Assembly I need to add as a reference. I have run "Install-Package Serilog.Sinks.File" from the "Package Manager Console" but that did not seem to have any effect or change.

    frjM5.png

    What directive am I missing or what assembly reference do I need?

    2xUTC.png

    I tried to figure this out via online documentation but I can not find the result.

  2. #2
    Join Date
    Aug 2022
    Posts
    22
    The error message you are seeing suggests that the compiler cannot find the "WriteTo.File" extension method for the Serilog LoggerConfiguration class. This is likely because of the assembly that contains the Serilog.Sinks.The file package is not being correctly referenced in your project.

    You can check the following:

    1. Make sure you are using the correct namespace for the Serilog.Sinks.File package. It should be "using Serilog.Sinks.File;".
    2. Verify that the Serilog.Sinks.File package is installed in your project by checking the dependencies in the project.json or the packages.config file depending on the version of visual studio you are using.
    3. If the package is installed, try to update the package to the latest version by running the command "Update-Package Serilog.Sinks.File" from the Package Manager Console.
    4. Try to reinstall the package by running the command "Uninstall-Package Serilog.Sinks.File" followed by "Install-Package Serilog.Sinks.File"
    5. Check if the assembly Serilog.Sinks.File.dll is present in your output folder, if not then check the references of the project and make sure the assembly is being referenced correctly.
    6. If none of the above works, you can try to create a new project and copy your code to the new project, sometimes, project-specific configurations can cause this kind of issue.

    If you still have issues after trying these steps, you can try to look for similar errors online or on forums, or you can reach out to the Serilog community for support.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •