Created On: 16 August 2012
Problem:
I have a managed code application that has a main project (.EXE) that calls programs in other projects (.DLLs) When the call is made to some of the programs in these other projects I get the following error:
Inner Exception: BadImageFormatException
Could not load file or assembly 'file:///X:\PLK\LXXO000.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format.
What is causing this error?
Inner Exception: BadImageFormatException
Could not load file or assembly 'file:///X:\PLK\LXXO000.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format.
What is causing this error?
Resolution:
This error means that most likely you have a mismatch between project types in regards to bitism such as a project defined as x64 or anyCPU is trying to call a program in a project defined as x86.
When calling between projects, you must ensure that the project types all match so that 32-bit calls 32-bit and 64-bit calls 64-bit, etc.
When you are using anyCPU it may work correctly when calling x86 or x64 projects on one computer and then fail when run on a different computer where the bitism is different.
When calling between projects, you must ensure that the project types all match so that 32-bit calls 32-bit and 64-bit calls 64-bit, etc.
When you are using anyCPU it may work correctly when calling x86 or x64 projects on one computer and then fail when run on a different computer where the bitism is different.