I have this setup:
- Winforms.exe, Framework 4.8. This references:
- Client.dll, .Net Standard 2.0 which uses
- IdentityModel.OidcClient 5.0.0 which uses
- System.Text.Json
Since Client.dll is not .Net Core 5.0, I added System.Text.Json as a NuGet package. This leads to the following exception when calling RefreshTokenAsync on OidcClient:
System.IO.FileLoadException: 'Could not load file or assembly 'System.Text.Json, Version=5.0.0.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)'
I tried a couple of things but none have worked so far:
Add the closest version to 5.0.0.2 of System.Text.Json I could find (5.0.0, 5.0.1) to Client.dll, issue remains.
Add the latest version to 5.0.0.2 of System.Text.Json I could find (6.0.1) to Client.dll, issue remains.
Add a package redirect to Winforms.exe (even though Generate Auto Redirects = true):
<dependentAssembly><assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/><bindingRedirect oldVersion="5.0.0.2" newVersion="6.0.1"/></dependentAssembly>
No dice
- Tried adding the NuGet (all different versions) to WinForms.exe, with or without redirect. Issue remains.
I'm not sure how to fix this anymore, any takers? Thanks so much in advance.