0
votes

So, I have a WebJob project that needed updating. I was running into DLL issues which was solved by this post:

https://github.com/Azure/azure-webjobs-sdk/issues/1633

The last comment states:

I would recommend folks use the more recent versions:

Microsoft.Azure.WebJobs (2.2.0)

Microsoft.NET.Sdk.Functions (1.0.21)

Newtonsoft.Json (9.0.1)

So that is what I did and my WebJob compiles. Great. Or so I thought. It turns out that my shared DLL uses the latest version of Newtonsoft's Json.Net (12.0.1) which is now throwing an error when I run my WebJob.

This is the error I am getting:

A ScriptHost error has occurred [29/11/2018 10:17:08] Cormar.Extensions: Could not load file or assembly 'Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified. [29/11/2018 10:17:08] Could not load file or assembly 'Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified. [29/11/2018 10:17:08] Cormar.Extensions: Could not load file or assembly 'Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.

Does anyone know how I can get around this?

1
Perhaps you could show us the error you are getting? - phuzi
I thought it was implied, but I will update my post - r3plica
What is Cormar.Extensions and who wrote it? - bommelding

1 Answers

0
votes

I managed to fix this. I did what the post said and set my nuget package version to:

  • Microsoft.Azure.WebJobs (2.2.0)
  • Microsoft.NET.Sdk.Functions (1.0.21)
  • Newtonsoft.Json (9.0.1)

And then I just edited the WebJob .csproj file and changed the Nuget PackageReference to this:

<PackageReference Include="Newtonsoft.Json" Version="11.0.0.0" />

And it worked.