Search code examples
jsonazureazure-webjobs

How can I resolve dependency conflicts in Azure WebJob SDK?


I am trying out the Azure WebJob SDK (v 0.3.1). I have packaged everything up and uploaded it, but in the dashboard I get the error:

"Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)"

I understand this to mean that a newer version of Newtonsoft.Json is referenced in the app than is referenced in the WebJob SDK. However, I have tried adding a dependency binding redirect to the app.config associated with the exe, but this does not change the error. I suspect that config is not being used at all. I have the following binding direct in both job.blah.exe.config and web.config:

  <dependentAssembly>
    <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
  </dependentAssembly>

Newtonsoft.Json is v6.0.0.0 in both projects.

What is the best way to resolve this issue?


Solution

  • I ran into the same issue with the Azure WebJob SDK. I got it working using the answer to this related question

      UnInstall-Package Microsoft.Azure.Jobs
    
      Install-Package Microsoft.Data.Services.Client -Version 5.6.0
      
      Install-Package Newtonsoft.Json -Version 4.0.5
    
      Install-Package Microsoft.Azure.Jobs