I've built a .net standard 2.0 library that I'm using for a cross platform project. For testing, I've created two console projects which use both .Net 7 and .Net 4.7.2 (Framework) to link to it.
Both work fine in Visual studio and I can get the .Net 7 one working fine on a VM. However, getting the .Net 4.7.2 one working has resulted in some kind of odd dependency hell.
When I run the program, I get this:
LOG: Attempting download of new URL file:///C:/Users/Ben/Desktop/472/System.Text.Json.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Major Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
'. ---> System.IO.FileLoadException: Could not load file or assembly 'System.Text.Json, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
at Microsoft.IdentityModel.Protocols.OpenIdConnect.OpenIdConnectConfigurationSerializer.Read(String json, OpenIdConnectConfiguration config)
The dll in the Desktop\472 folder is the 6.0 version of System.Text.Json.dll. And the .netstandard 2.0 library calls for that version in it's dependencies:
So, I simply don't understand why, at runtime on a VM, the 4.0.1.2 version of the library would be sought.. It's as if it's trying to load the version associated .Net framework even though all those libraries have come from the .netstandard project.
The only thing the 4.7.2 console project links to is the bare system libs and the .netstandard 2.0 project. So this dependency seems to be unlisted anywhere...
Can anyone tell me what's going on?

