• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 630
  • Last Modified:

BadimageFormatException

When I run my application in Visual Studio in Debug mode, it runs fine. When I run it in Release mode,  I get BadimageFormatException: Could not load file or assembly.
Where should I be looking for difference in Debug/Release loading?
0
allelopath
Asked:
allelopath
4 Solutions
 
Alan WarrenCommented:
Are you running 64 bit on both your dev server and your production server?

Alan
0
 
Naman GoelSoftware engineer 1Commented:
Project propertiesGoto Project properties and all the dependent project properties --> Build tab select Release from configuration select Platform target as Any CPU
0
 
allelopathAuthor Commented:
naman_goel:
Thanks but it looks like all projects in the solution were already set to Any CPU
0
 
Naman GoelSoftware engineer 1Commented:
check each and every dll with coreflag tool

Please use tool CorFlags.exe to view the header of the DLL to identify
which target platform it is compiled to. Following are the instructions:
1. Open Visual Studio command prompt.
2. Type "CorFlags.exe <Assembly File Path>".
3. You will see its output like this:
Version : v2.0.50727
CLR Header : 2.5
PE : PE32
CorFlags : 11
ILONLY : 1
32BIT : 1
Signed : 1
4. The PE and 32BIT flags can be used to determine the type of the
assembly, please look up the following table:
anycpu: PE = PE32 and 32BIT = 0
x86: PE = PE32 and 32BIT = 1
64-bit: PE = PE32+ and 32BIT = 0

For more information, please refer to following links:

Moving from 32-bit to 64-bit application development on .NET Framework:
http://blogs.msdn.com/gauravseth/archive/2006/03/07/545104.aspx

and make sure that all assemblies used in same format
0
 
Roopesh ReddyIT AnalystCommented:
Hi,

Try setting the Platform Target to x86 and make sure you set this configuration for Release!

VS Properties
Hope it helps u...
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now