Repository navigation
Cannot add Serilog.Sinks.File to .NET Core 3.x #104
Copy link
Copy link
Closed
Labels
Description
Using 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 ?
Activity
nblumhardt commentedon Jun 7, 2019
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
alexrp commentedon Jan 22, 2020
I just ran into this in a
netcoreapp3.1project. I had to add the following:Can anything be done to not require these?
Serilog.Sinks.Fileis the only package in this fairly large project for which I've had to do this.nblumhardt commentedon Jan 24, 2020
Thanks for the nudge, @alexrp - reopening so that someone might be able to PR an update for this 👍
[-]cannot add Serilog.Sinks.File[/-][+]Cannot add Serilog.Sinks.File to .NET Core 3.x[/+]philpowers commentedon Feb 18, 2020
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.
Mgamerz commentedon Jul 19, 2020
Any chance the production version of this will be fixed anytime soon? I can build for windows platforms on .net core 3.1 but when I build for linux-x64 I get the downgrade messages as posted above.
I also tried using the prerelease nuget package, but it didn't fix it either.