Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3067

How to resolve package reference issue in NetStandard 2.0 library used by Framework 4.8?

$
0
0

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:

  1. 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.

  2. Add the latest version to 5.0.0.2 of System.Text.Json I could find (6.0.1) to Client.dll, issue remains.

  3. 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

  1. 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.


Viewing all articles
Browse latest Browse all 3067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>