'.NET Worker Service: Failure processing application bundle, bundle header version compatibility check failed

I've developed a Worker Service in .NET (.NET 5) which runs successfully. I'm then publishing the application using the following publish command.

dotnet publish MyWorkerService.csproj -c release --output Dll/MyWorkerService -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:DebugType=None -p:DebugSymbols=false -p:AllowedReferenceRelatedFileExtensions=*.pdb

This successfully publishes the application, but when I go to execute the exe I get the following error. enter image description here

What is causing this issue?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source