'.NET 6 Azure Web App Could not load file or assembly newtonsoft.json

I am getting the following error in Azure when running my web app, this all works fine localy:

Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'. The system cannot find the file specified. File name: 'Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'

I have seen solutions by using binding redirects but I don't know how to achieve this in a .net 6 web app that does not have a web config.

The failing .prj is a class lib (.net 6) and I am referencing it in my web app ( also .net 6).

Do I need to configure my web app to use a web config?

I also see this in my release pipline:

warning NU1603: Persistence depends on Newtonsoft.Json (>= 13.0.0) but Newtonsoft.Json 13.0.0 was not found. An approximate best match of Newtonsoft.Json 13.0.1 was resolved. [/home/gitlab-runner/builds/vzaXzjFo/0/bi-data-solutions/SAEPIO/Portal/SAEPIO.sln]

I don't even see a 13.0.0 reference anywhere in my projects.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source