What is the right approach of updating service which is using hangfire?

I’m trying to update dotnet core app with the newer version and facing a weird issue.
After the app restart hangfire is unable to reschedule recurring jobs.
If shows lots of following errors:

2018-11-30 16:49:00.5331 +07:00||WARN|Hangfire.Server.RecurringJobScheduler||Recurring job ‘3a65123c-167a-60c9-3afd-960a9305ec66_utilization’ can not be scheduled due to job load exception. Hangfire.Common.JobLoadException: Could not load the job. See inner exception for the details. —> System.IO.FileLoadException: Could not load file or assembly ‘ProcessHandler, Version=1.0.0.33917, Culture=neutral, PublicKeyToken=null’. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName, ObjectHandleOnStack type, ObjectHandleOnStack keepalive)

Library exists but it’s version was changed from “1.0.0.33917” to “1.0.0.34140”.
How to correctly handle such cases?
What is the correct way to update jobs to a new version?

1 Like