okuma

System.BadImageFormatException on PC running PC Sim software


I'm getting this exception: System.BadImageFormatException was unhandled whenever I try to run a program compiled on my PC. I'm running the Okuma PC Sim software on my laptop.
This happens even if I open and compile the API Test app that ships with the API.
Below are the exception details:

System.BadImageFormatException was unhandled
  Message= is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)
  Source=thincLathe
  StackTrace:
       at thincLathe.frmMain.Form1_Load(Object sender, EventArgs e)
       at System.Windows.Forms.Form.OnLoad(EventArgs e)
       at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
       at System.Windows.Forms.Control.CreateControl()
       at System.Windows.Forms.Control.WmShowWindow(Message& m)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Solution

  • Please reference http://support.microsoft.com/kb/967163

    Long KB short... change your compile settings in VS. The "ANYCPU" setting should be changed to match the target system, x86 or x64.