Troubleshooting Badimageformatexception

Troubleshooting BadImageFormatException


Verified build settings such as Platform Target are all the same (x86).

That's not what the crash log says:

Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64

Note the 64 in the name, that's the home of the 64-bit version of the framework. Set the Target platform setting on your EXE project, not your class library project. The XxxDevicesService EXE project determines the bitness of the process.

BadImageFormatException C#

Make sure that you are not having 32-bit / 64-bit conflict.

Refer this question:

Troubleshooting BadImageFormatException

If you're running on a 64-bit OS, the Assembly RevitAPI may be compiled as 32-bit and your process as 64-bit or "Any CPU".

Or, the RevitAPI is compiled as 64-bit and your process is compiled as 32-bit or "Any CPU" and running on a 32-bit OS.

System.BadImageFormatException: Could not load file or assembly

It seems that you are using the 64-bit version of the tool to install a 32-bit/x86 architecture application. Look for the 32-bit version of the tool here:

C:\Windows\Microsoft.NET\Framework\v4.0.30319

and it should install your 32-bit application just fine.

Could not load file or assembly ... An attempt was made to load a program with an incorrect format (System.BadImageFormatException)

I am pretty sure you're having a 32-bit / 64-bit conflict. It sounds like your main project might be set to 32-bit while the class its referencing is set to 64-bit. Try looking at this SO question and this one too. Between the two of them, you should be able to figure out your problem.

BadImageFormatException debugging web site running in x64 mode

Try to follow the instructions from Debugging VS2013 Websites Using 64-bit IIS Express:

If you are working on ASP.NET MVC web sites in Visual Studio 2013
(VS2013), you need to make one registry change if you want to run IIS
Express as a 64-bit process by default. Use one of the methods,
below.

Command-Line:

reg add HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\WebProjects /v Use64BitIISExpress /t REG_DWORD /d 1

System.BadImageFormatException

Change in Visual Studio IDE, the Platform target from “X86 ” to “Any CPU”.

Refer to here Troubleshooting BadImageFormatException



Related Topics



Leave a reply



Submit