Fail to load package dependency at runtime

25 Views Asked by At

My solution uses central package management and targets .net6.0 framework and at execution I get the following exception:System.IO.FileNotFoundException: 'Could not load file or assembly 'System.Text.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.'

Dependencies look similar to

ProjectA -> library -> System.Net.Http.Json 7.0.1 -> System.Text.Json 7.0.2
ProjectB -> (ProjectReference) ProjectA
ProjectB -> Azure.Monitor.Injestion (1.1.1) -> System.Text.Json 7.0.2 

It is ProjectB execution which throws the exception.

I dont want to downgrade library to hopefully get to 7.0.0 version for System.Text.Json somehow.

I did try to use <PackageReference Include="System.Text.Json" VersionOverride="7.0.0" /> for ProjectB, cant figure it out.

0

There are 0 best solutions below