DotImage Knowledgebase

Home : Cause of System.BadImageFormatException
Q10165 - FAQ: Cause of System.BadImageFormatException
When deploying an application in .net 2.0, you might run into this error:

System.BadImageFormatException: Could not load file or assembly 'Atalasoft.dotImage' or one of its dependencies. An attempt was made to load a program with an incorrect format.

This may occur on a 64 bit machine running .net 2.0.  DotImage assemblies have unmanaged code in them, so they always need to be run in the 32 bit runtime.  "BadImageFormat" is referring to the format of the dll, it means .net tried to load a 32bit only assembly into the 64 bit runtime.

To get around this, your application needs to be compiled for 32 bit mode, so it will never be loaded in the 64 bit runtime.  Visual Studio 2005 offers 3 options for "Target Platform":

x86: 32bit only
x64: 64bit only
any CPU: let .net choose

Select 'x86' for your application so that it will always be loaded in 32 bit runtime.

Related Articles
No Related Articles Available.

Article Attachments
No Attachments Available.

Related External Links
No Related Links Available.
Help us improve this article...
What did you think of this article?

poor 
1
2
3
4
5
6
7
8
9
10

 excellent
Tell us why you rated the content this way. (optional)
 
Approved Comments...
Solved my problem. Approved: Wednesday, January 28, 2009

Powered By InstantKB.NET v1.3
Copyright © 2002, 2013. InstantASP Ltd. All Rights Reserved

preload preload preload