System.IO.FileNotFoundException thrown when publishing SXA sites


Description

After publishing Sitecore Experience Accelerator (SXA) items the following error might occur in the log records:

ManagedPoolThread #2 11:22:34 ERROR One or more exceptions occurred while processing the subscribers to the 'publishingservice:publishend' event.
Exception[1]: System.IO.FileNotFoundException 
Message[1]: Could not load file or assembly 'Sitecore.Framework.Publishing.Abstractions, Version=2.1.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. 
Source[1]: Sitecore.XA.Foundation.Publication 
   at Sitecore.XA.Foundation.Publication.Pipelines.PublishEndResultBatch.CheckMediaItemPath.Process(PublishEndResultBatchArgs args)
   at (Object , Object )
   at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
   at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists)
   at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain)
   at System.Reactive.Linq.ObservableImpl.Do`1._.OnNext(TSource value)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Reactive.ExceptionHelpers.ThrowIfNotNull(Exception exception)
   at System.Reactive.Linq.QueryLanguage.LastOrDefaultInternal[TSource](IObservable`1 source, Boolean throwOnEmpty)
   at Sitecore.Events.Event.EventSubscribers.RaiseEvent(String eventName, Object[] parameters, EventResult result) 
...

The root cause of the issue is that new Sitecore Publishing Service Module versions use restructured libraries, which require updating assembly references.

The issue occurs under the following environment:

Solution

To resolve the issue, consider one of the following options:

Note: After installing the hotfix, your solution will not be compatible with Sitecore Publishing Service 4.0.0.