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.