Disclaimer: I am a consultant at Amazon Web Services, and this is my personal blog. The opinions expressed here are solely mine and do not reflect the views of Amazon Web Services (AWS). Any statements made should not be considered official endorsements or statements by AWS.
Please check out the root cause and solution for the below error message.
An unhandled exception of type 'System.BadImageFormatException' occurred in SomeService.exe.
Additional information: Could not load file or assembly 'SomeAssembly, Version=1.0.0.XXXXX, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.
It seems like you have taken the reference of any assembly whose target platform is x64
and your current project's target platform is x86 (32 bit)
or vice versa.
To fix the issue, you have to make sure that your current project and the DLL your project is referencing, both should have the same target platform.