Found conflicts between different versions of System.Text.Json - SDK itself references older version?

427 Views Asked by At

We're developing a Razor Pages web app that has been upgraded to .Net 7 a while ago. The app also uses a couple of assemblies from a .Net Framework 4.7.2 solution we also develop.

Both, the web app and some of the referenced assemblies, use System.Text.Json for de/serializing. Now, whenever I want to compile the web app, I get the above mentioned warning "Found conflicts between different versions of System.Text.Json that could not be resolved". One of the used versions is 7.0.2, which is used by the .Net Framework solution as well as the web app. The other version is 7.0.0 which - according to the warnings' details - is referenced by the package Microsoft.NETCore.App.Ref. NuGet Gallery tells me that this is an internal package.

Now, the question is, how do I get this package to refer to the newest System.Text.Json or else get rid of it altogether, in case it isn't needed?

Es wurden Konflikte zwischen verschiedenen Versionen von "System.Text.Json" gefunden, die nicht aufgelöst werden konnten. Konflikt zwischen System.Text.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 und System.Text.Json, Version=7.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51. System.Text.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 wurde aufgrund der primären Eigenschaft System.Text.Json, Version=7.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 vorgezogen. Verweise, die von "System.Text.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" abhängig sind [C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\7.0.5\ref\net7.0\System.Text.Json.dll]. C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\7.0.5\ref\net7.0\System.Text.Json.dll Elementincludes einer Projektdatei, die den Verweis "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\7.0.5\ref\net7.0\System.Text.Json.dll" verursacht haben. C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\7.0.5\ref/net7.0/System.Text.Json.dll Verweise, die von "System.Text.Json, Version=7.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" abhängig sind [C:\Projekte\xxx\Assemblies\System.Text.Json.dll]. C:\Projekte\xxx\bin\Debug\net7.0-windows\xxx.dll Elementincludes einer Projektdatei, die den Verweis "C:\Projekte\xxx\bin\Debug\net7.0-windows\xxx.dll" verursacht haben. C:\Projekte\xxx\bin\Debug\net7.0-windows\xxx.dll C:\Projekte\xxx\Assemblies\xxx.dll Elementincludes einer Projektdatei, die den Verweis "C:\Projekte\xxx\Assemblies\xxx.dll" verursacht haben. xxx xxx xxx C:\Projekte\xxx\bin\Debug\net7.0-windows\xxx.dll C:\Projekte\xxx\Assemblies\xxx.dll Elementincludes einer Projektdatei, die den Verweis "C:\Projekte\xxx\Assemblies\xxx.dll" verursacht haben. xxx C:\Projekte\xxx\Assemblies\xxx.dll Elementincludes einer Projektdatei, die den Verweis "C:\Projekte\xxx\Assemblies\xxx.dll" verursacht haben. xxx xxx xxx C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets 2352

This is one of the warnings' details. The xxx'ed out bits are our assemblies used in the web app.

Well, before I upgraded everything to System.Text.Json 7.0.2 recently, some bits were running with System.Json.Text 7.0.0 while others used 7.0.1, in order to keep compatibility with the web app. Of course, we'd really like to to have everything reference the same version. Also, we now need functionality that has only been added with 7.0.1 or 7.0.2, so getting back to that mixed-versions setup would mean quite a bit of working around that on top of just not feeling good.

We appreciate any hints helping us to solve this issue once and for all!

0

There are 0 best solutions below