Cannot add Serilog.Sinks.File to .NET Core 3.x
See original GitHub issueUsing latest .NET Core v3.0.0-preview5
My proj has:
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Hosting.WindowsServices" Version="3.0.0-preview5-19227-01" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.0.0-preview5-19227-01" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.0.0-preview5.19227.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
<PackageReference Include="Serilog" Version="2.9.0-dev-01091" />
<PackageReference Include="Serilog.Extensions.Hosting" Version="2.0.1-dev-00009" />
</ItemGroup>
I then try to install package Serilog.Sinks.File
I get:
Severity Code Description Project File Line Suppression State
Error NU1605 Detected package downgrade: System.IO.FileSystem.Primitives from 4.3.0 to 4.0.1. Reference the package directly from the project to select a different version.
DashboardServer -> Serilog.Sinks.File 4.1.0-dev-00838 -> System.IO.FileSystem 4.0.1 -> runtime.win.System.IO.FileSystem 4.3.0 -> System.IO.FileSystem.Primitives (>= 4.3.0)
DashboardServer -> Serilog.Sinks.File 4.1.0-dev-00838 -> System.IO.FileSystem 4.0.1 -> System.IO.FileSystem.Primitives (>= 4.0.1) DashboardServer C:\src\epax\Dashboard\DashboardServer\DashboardServer.csproj 1
Error NU1605 Detected package downgrade: System.Text.Encoding.Extensions from 4.3.0 to 4.0.11. Reference the package directly from the project to select a different version.
DashboardServer -> Serilog.Sinks.File 4.1.0-dev-00838 -> System.IO.FileSystem 4.0.1 -> runtime.win.System.IO.FileSystem 4.3.0 -> System.Text.Encoding.Extensions (>= 4.3.0)
DashboardServer -> Serilog.Sinks.File 4.1.0-dev-00838 -> System.Text.Encoding.Extensions (>= 4.0.11) DashboardServer C:\src\epax\Dashboard\DashboardServer\DashboardServer.csproj 1
Error NU1605 Detected package downgrade: System.Runtime.Handles from 4.3.0 to 4.0.1. Reference the package directly from the project to select a different version.
DashboardServer -> Serilog.Sinks.File 4.1.0-dev-00838 -> System.IO.FileSystem 4.0.1 -> runtime.win.System.IO.FileSystem 4.3.0 -> System.Runtime.Handles (>= 4.3.0)
DashboardServer -> Serilog.Sinks.File 4.1.0-dev-00838 -> System.IO.FileSystem 4.0.1 -> System.Runtime.Handles (>= 4.0.1) DashboardServer C:\src\epax\Dashboard\DashboardServer\DashboardServer.csproj 1
Error CS1061 'LoggerSinkConfiguration' does not contain a definition for 'File' and no accessible extension method 'File' accepting a first argument of type 'LoggerSinkConfiguration' could be found (are you missing a using directive or an assembly reference?) DashboardServer C:\src\epax\Dashboard\DashboardServer\Program.cs 55 Active
Error CS1061 'DbContextOptionsBuilder' does not contain a definition for 'UseSqlite' and no accessible extension method 'UseSqlite' accepting a first argument of type 'DbContextOptionsBuilder' could be found (are you missing a using directive or an assembly reference?) DashboardServer C:\src\epax\Dashboard\DashboardServer\Startup.cs 37 Active
Warning MVC1005 Using 'UseMvc' to configure MVC is not supported while using Endpoint Routing. To continue using 'UseMvc', please set 'MvcOptions.EnableEndpointRounting = false' inside 'ConfigureServices'. DashboardServer C:\src\epax\Dashboard\DashboardServer\Startup.cs 106 Active
Error Package restore failed. Rolling back package changes for 'DashboardServer'.
How do I solve this ?
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Serilog reference cannot add in asp.net core
I want to make a logger using Serilog in asp.net core but I am facing a problem in adding reference of serilog in...
Read more >Serilog in ASP.NET Core 3.1 - Structured Logging Made ...
In this article, let's go through Serilog in ASP.NET Core 3.1 and it's implementations. Now by default, ASP.NET Core comes with some basic...
Read more >Setting up Serilog in ASP.NET Core 3
Adding a sink to record structured events. So far, we've seen WriteTo.Console() and WriteTo.File() , both of which are available through the ...
Read more >Setting up Serilog in ASP.NET Core - Detailed Beginner ...
To configure structured logging using Serilog in ASP.NET Core we will make use of the File sink and write logs to files in...
Read more >How to Use Serilog in ASP.NET Core Web API
Learn how to use Serilog in .NET applications. It offers a simple interface for .NET logging and countless log targets (sinks).
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The PackageReference workaround didn’t work for me for some reason. In my case, I’m trying to bundle a .NET Core 3.1 WPF application into a Desktop Bridge project.
For now I’ve had to simply remove the reference to Serilog.Sinks.File, which of course is not ideal. I see there is a fix pending, so I’m hoping that I’ll be able to re-add it soon.
Hi! You can add:
to your CSPROJ.
I think we may need to update the dependency versions in this package to avoid this annoyance once 3.0 is out.
https://github.com/serilog/serilog-sinks-file/blob/dev/src/Serilog.Sinks.File/Serilog.Sinks.File.csproj#L58