Reputation: 6778
I get a BadImageFormatException when running a C#/VB SmartClient application with the Any CPU
configuration. If I use x86
configuration then it runs fine. This is an old, legacy project which I occasionally have to modify and I don't know the history, so I can only guess that there are dlls that contain 32-bit native code causing this error. This all makes sense, except that when the configuration is Debug
& AnyCPU
it runs, only when the configuration is Release
& AnyCPU
does it fail. I see no significant differences in the Debug.cfg.xml and Release.cfg.xml files.
Can anyone say why it would run in the Debug
configuration? Since this works I wonder if it is somehow possible to get it running in x64 (ie AnyCPU)
From the app.config:
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"/>
</startup>
Upvotes: 0
Views: 599
Reputation: 691
Try changing window or form icon image format from .jpg to .png. sometimes on windows server this error occurred because of icon image format.
Upvotes: 0
Reputation: 613461
Your application almost certainly depends on a 32 bit component. When you run your application as a 64 bit process, it fails to load that 32 bit component into your process.
Possible solutions include:
Upvotes: 1