.net Framework Error (HRESULT 0x8007000B)


I have a C# application which was written on a 32bit windows XP machine with Visual Studio 2005. The application runs fine on Windows XP machines, however when I try to run it on a 64bit Windows 7 professional machine, I get the following dialog-box on start up:

enter image description here

Here is the full text from the details.

  See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
   at ICSNeoCSharp.IcsNeoDll.icsneoTxMessages(Int32 hObject, IcsSpyMessage& pMsg, Int32 lNetworkID, Int32 lNumMessages)
   at ICSNeoCSharp.FormDTCApplication.transmitFlowControl(Int32 myArbID) in C:\Documents and Settings\Administrator\Desktop\Adam Stuff ThinkPad\DTC Checker FINAL\frmDTCApp.cs:line 1750
   at ICSNeoCSharp.FormDTCApplication.flowControlTimer_Tick(Object sender, EventArgs e) in C:\Documents and Settings\Administrator\Desktop\Adam Stuff ThinkPad\DTC Checker FINAL\frmDTCApp.cs:line 5166
   at System.Windows.Forms.Timer.OnTick(EventArgs e)
   at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

************** Loaded Assemblies **************
    Assembly Version:
    Win32 Version: 2.0.50727.5472 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/mscorlib.dll
DTC Checker V1.0
    Assembly Version: 1.0.4960.25549
    Win32 Version: 1.0.4960.25549
    CodeBase: file:///C:/DTC%20Checker%20V1.0%20R3/DTC%20Checker%20V1.0%20R3.exe
    Assembly Version:
    Win32 Version: 2.0.50727.5468 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/
    Assembly Version:
    Win32 Version: 2.0.50727.5467 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/
    Assembly Version:
    Win32 Version: 2.0.50727.5467 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/
    Assembly Version:
    Win32 Version: 12.0.6600.1000
    CodeBase: file:///C:/Windows/assembly/GAC/Microsoft.Office.Interop.Excel/

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging

For example:

    <system.windows.forms jitDebugging="true" />

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

Has anyone else encountered this error and succeeded in solving it?

asked on Stack Overflow Aug 2, 2013 by Adam Jakiela

10 Answers


While your main app might be built for AnyCPU are you sure all the assemblies are AnyCPU? Do you have any native assemblies or assemblies that contain native code? Are they built against x86?


This tells me that the app is running as an x64 process but it would appear that there is some assembly that isn't AnyCPU or x64 which is likely the cause of the BadImageFormatException.

One thing you can try is to run the application from a 32-bit command prompt (c:\windows\SysWow64\cmd.exe) to force it to be a 32-bit process and see if that works. If that works then there is definitely some assembly that is not AnyCPU.

answered on Stack Overflow Aug 2, 2013 by Wes Haggard

Project Properties -> Build -> Platform target -> x86 may solve this problem.

answered on Stack Overflow Nov 6, 2014 by Yuliia Ashomok • edited May 7, 2015 by Yuliia Ashomok

One of the most common mistake is we forgot to change the test program and wrapper program to the correct platform. See the below image

enter image description here

(in the top bar it is showing the platform is x64 but you need to make sure if it is really exists in the 2nd image ...)

enter image description here

Make sure you have right configuration on the Configuration Manager...if your config do not match with the actual config of your c++ dll it will give BadImageFormatException.

I learned from the mistake after searching a lot ... and finally got this

answered on Stack Overflow Oct 3, 2017 by MD. Nazmul Kibria

In my case I had the 0x8007000B error because the app was running in 32 bit, on my 64 windows 7. I solved it by going in windows/syswov64 folder changing the MSVCR110.dll version 64 bit with the MSVCR110.dll version 32 bit.

(Just don't forget to put back the 64 dll after. Each time you need to run your 32 bit app, just move the dll 32 on it).

You could find the dll versions here (Unzip it before pasting into the syswov64 folder).

answered on Stack Overflow Apr 1, 2016 by JinSnow • edited Feb 23, 2019 by JinSnow

From my experience the cause of that error is the .Net Framework Version

Check your .Net Framework version and update and also check the .Net version of your application.

answered on Stack Overflow Aug 2, 2013 by Leonel Sarmiento

My issue was solved by compiling with 32 bit as Wix currently doesnt have 64. Your installer msi will in any case be 64 bit


answered on Stack Overflow Mar 8, 2016 by Ashish

I would like to add also my finding: I unchecked in a project properties in Build tab a "Prefer 32-bit" and got this error. After re-checking, it was gone. I have Any CPU set as a target.

I am aware that this is not a definite solution, just a symptom-solving, but it might be of help.

answered on Stack Overflow Mar 3, 2017 by Rao

The fix for me was to change the Application Pool in IIS. Open the application pool properties and go to Advanced Settings... Then change "Enable 32-bit Applications" to True. The default is False for a new one. The code part was set to "Any CPU" although I have fixed issues in the past by setting the CPU to x86.

answered on Stack Overflow Jun 13, 2017 by smoore4

I had this error when my solution called a 32 bit dll. In addition to making the platform changes referred to in other replies above, in VS2017 Project {yourproject} Properties Services, I had to change "Use Windows authentication" to "Use Forms authentication"

Services tab is selected, and in the Authentication section "Use Forms authentication" is selected and circled in red

answered on Stack Overflow Jun 11, 2018 by Peter Chambers • edited Jun 11, 2018 by Andrew Myers

I had to combine solutions from 2-3 different answers to resolve the same error. The reason is, the final setup had dlls from both x86 and x64 platforms(in separate folders for separate exes).

1) I set the platform target of my main app as 64 bit and left configuration settings as it is and built it: enter image description here

2) I set the Target platform of my Deployment project as x64.

3) The dlls were getting mixed between the folders so i checked source path of all dlls in the File Types Editor one by one and replaced them according to their architectures.

4) Finally built the deployment project with following configuration settings: enter image description here

The above mentioned combination is the only one that worked.

answered on Stack Overflow Oct 4, 2018 by Talha Imam

User contributions licensed under CC BY-SA 3.0