I'm getting the following exception when my Azure WebJob handler starts up:
System.IO.FileLoadException was unhandled FileName=Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
FusionLog==== Pre-bind state information === LOG: DisplayName = Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed (Fully-specified) LOG: Appbase = file:///C:/Programming/ConnellCampaigns/src/UploadProcessor/bin/Debug/net46/win7-x64/ LOG: Initial PrivatePath = NULL Calling assembly : Microsoft.Azure.WebJobs.Host, Version=1.1.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35. === LOG: This bind starts in default load context. LOG: Using application configuration file: C:\Programming\ConnellCampaigns\src\UploadProcessor\bin\Debug\net46\win7-x64\UploadProcessor.exe.Config LOG: Using host configuration file: LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config. LOG: Redirect found in application configuration file: 6.0.0.0 redirected to 6.0.0.0. LOG: Post-policy reference: Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed LOG: Attempting download of new URL file:///C:/Programming/ConnellCampaigns/src/UploadProcessor/bin/Debug/net46/win7-x64/Newtonsoft.Json.DLL. WRN: Comparing the assembly name resulted in the mismatch: Major Version ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.HResult=-2146234304 Message=Could not load file or assembly 'Newtonsoft.Json, Version=6.0.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)
Source=Microsoft.Azure.WebJobs.Host StackTrace: at Microsoft.Azure.WebJobs.Host.Protocols.PersistentQueueWriter1.<EnqueueAsync>d__0.MoveNext() at System.Runtime.CompilerServices.AsyncTaskMethodBuilder
1.Start[TStateMachine](TStateMachine& stateMachine) at Microsoft.Azure.WebJobs.Host.Protocols.PersistentQueueWriter`1.EnqueueAsync(T message, CancellationToken cancellationToken) at Microsoft.Azure.WebJobs.Host.Loggers.PersistentQueueLogger.LogHostStartedAsync(HostStartedMessage message, CancellationToken cancellationToken) at Microsoft.Azure.WebJobs.Host.Executors.JobHostContextFactory.LogHostStartedAsync(IFunctionIndex functionIndex, HostOutputMessage hostOutputMessage, IHostInstanceLogger logger, CancellationToken cancellationToken) at Microsoft.Azure.WebJobs.Host.Executors.JobHostContextFactory.d__b.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Azure.WebJobs.Host.Executors.JobHostContextFactory.d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Azure.WebJobs.JobHost.d__f.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Azure.WebJobs.JobHost.d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Azure.WebJobs.JobHost.Start() at Microsoft.Azure.WebJobs.JobHost.RunAndBlock() at UploadProcessor.Program.Main(String[] args) in C:\Programming\ConnellCampaigns\src\UploadProcessor\Program.cs:line 25 InnerException:
This only happens if I specify the latest version - 9.0.1 - of NewtonSoft's JSON assembly in project.json.
I can make the error go away by specifying the last v6 issue of the library (6.0.8). But that introduces dependency warnings.
I don't understand why Microsoft.Azure.WebJobs.Host insists on an older version of the library. Its nuget page says it's compatible with any version >= 6.0.8.
How do I resolve this?