I have an Azure Function project with multiple Nuget packages installed. These packages depend on different versions of Newtonsoft, and that's causing problems. I understand from this post (Newtonsoft.json assembly package version mismatch) that the normal solution is to add an assembly-binding configuration (ie: a redirect) to the config file.
How would one accomplish this in an Azure function, which doesn't have a config file?
I added an App.config
file to the project, and it now looks like this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.2"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
But I still get the same error:
Could not load file or assembly 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.
Thanks!