0

It seems that from version 109 to 110 RestSharp has dependency on System.Text.Json >= 7.0.2 for net6.0.

net6.0 dependency on 7.0.2

I am using the library on an net6.0 Azure functions project. Once updating to RestSharp 110 I get the issue that System.Text.Json 7.0.2 dll cannot be found because Azure functions projects loads version 6. The error is only thrown when RestSharp is invoked, there are no compilation errors and the Azure function starts fine. The error is also thrown both locally and when the app is published.

Any reason why net6.0 requires v7.0.2 for System.Text.Json? Any suggestions for a workaround on this so that I am able to update RestSharp past 109 which works without issues.

I tried to update RestSharp to v110 from v109. My Azure functions project is net6.0. It loads System.Text.Json v6 and errors are thrown that v7 cannot be found.

  • `System.Next.Json` 7.0.2 is compatible with .NET 6. I am not sure why it was not published with your app as it's a direct package dependency. The runtime is expected to load the dependency. If you manually excluded that library from the deployment package, you should bring it back. – Alexey Zimarev May 11 '23 at 15:09
  • It's a duplicate of https://stackoverflow.com/questions/76138571/restsharp-could-not-load-file-or-assembly-system-text-json-version-7-0-0-0 – Alexey Zimarev May 11 '23 at 15:14
  • It seems Azure functions runtime load system.text.json v6 because it's a net6 project. I do not know how to force it to load v7 – Branimir Lochert May 12 '23 at 16:56
  • It should use the published application directory first. Have you been able to check what gets deployed? – Alexey Zimarev May 15 '23 at 17:35
  • Does this answer your question? [RestSharp: Could not load file or assembly 'System.Text.Json, Version=7.0.0.0](https://stackoverflow.com/questions/76138571/restsharp-could-not-load-file-or-assembly-system-text-json-version-7-0-0-0) – Alexey Zimarev May 24 '23 at 14:02

0 Answers0