serilog-sinks-file icon indicating copy to clipboard operation
serilog-sinks-file copied to clipboard

Detected package downgrade: System.IO from 4.3.0 to 4.1.0.

Open Yaz-X opened this issue 4 years ago • 11 comments

Hello,

i'm getting this error when publishing Website (Asp.net Core Version 3.1.8):

Detected package downgrade: System.IO from 4.3.0 to 4.1.0. Reference the package directly from the project to select a different version. Serilog.Sinks.File 4.1.0 -> System.IO.FileSystem 4.0.1 -> runtime.win.System.IO.FileSystem 4.3.0 -> System.IO (>= 4.3.0) Serilog.Sinks.File 4.1.0 -> System.IO.FileSystem 4.0.1 -> System.IO (>= 4.1.0)

Yaz-X avatar Sep 14 '20 06:09 Yaz-X

For .NET Core 3.x builds I think that should be fixed in the pre-release packages (see #139 and #172) as the references to the System packages are removed in Core 3.0 targets.

Otherwise, does adding a System.IO reference to the website avoid/fix the error?

Numpsy avatar Oct 06 '20 10:10 Numpsy

Sorry for not updating this post, Yes i had to add the references with the correct versions for it to publish successfully as a workaround.

Yaz-X avatar Oct 06 '20 13:10 Yaz-X

Was having this exact issue. Updating the file plugin to 5.0 pre-release fixed it. I didn't update the main Serilog though, not sure if that matters.

Mgamerz avatar Nov 03 '20 17:11 Mgamerz

I have the same issue in my WPF project for .net5. I must add these lines to my csproj file to make it work. I also tried to use the pre-release package, but this didn't fix the problem.

<PackageReference Include="System.IO.FileSystem.Primitives" Version="4.3.0" />
<PackageReference Include="System.Text.Encoding.Extensions" Version="4.3.0" />
<PackageReference Include="System.Runtime.Handles" Version="4.3.0" />

JochnGst avatar May 04 '21 07:05 JochnGst

I believe this is fixed on the newest 5.0 dev versions. Will ship an RTM shortly.

nblumhardt avatar Jun 22 '21 02:06 nblumhardt

(see also #166, #210)

nblumhardt avatar Jun 22 '21 02:06 nblumhardt

We just ran into this on .net 7 using the new container publish task. No other projects are affected and all our nuget packages refernce the same version. We fixed it by including this in our packagereferences

<PackageReference Include="Microsoft.NETCore.App" Version="2.2.0" ExcludeAssets="all" PrivateAssets="all" />

https://github.com/dotnet/sdk/issues/3044#issuecomment-476795447

It might be time to nudge the minimum framework version targets for this (and Serilog) forwards. Reopening, though I don't think the change will be made here until the upstream Serilog 3.0 happens. Thanks for leaving a note 👍

nblumhardt avatar Dec 22 '22 02:12 nblumhardt

@nblumhardt bumping

bartelink avatar Feb 21 '24 09:02 bartelink

@bartelink guess it's time to bump dev in serilog/serilog to 4.0, and get started on all of this :-) ... I'll do that today :+1:

nblumhardt avatar Feb 22 '24 00:02 nblumhardt

There is a way to fix this without needing to push a new package with Directory.Packages.props to host all the packages and using Central Package Management to override the version of System.IO that is used by Serilog.

AraHaan avatar Feb 22 '24 07:02 AraHaan