Author Topic: BadImageFormatException was unhandled  (Read 7716 times)

Offline tensai sensei

  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
on: March 17, 2008, 05:11:54 PM
Okay I think this is where the post should go.. I got the WiimoteTest to work (that relays the button/etc. inputs from the wiimote) and with atomriot's help post I got the Whiteboard app to work.  However, I can't seem to get the Multipoint Grid to compile/run.

I'm running Vista 64-bit, with the DirectX SDK April 2007 installed and I'm using VC# 2008 Express to compile.  Now, when I run the .exe it returns an error "Microsoft DirectX SDK Sample has stopped working" even though I've installed DX SDK.  When I open the .csproj and compile, it gives me the error "BadImageFormatException was unhandled" and says that BadImageFormatException is not a valid Win32 application (Exception from HRESULT: 0x800700C1).

Here are the details:
Code: [Select]
System.BadImageFormatException was unhandled
  Message=" is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)"
       at System.Reflection.Assembly._nGetEntryPoint()
       at System.Reflection.Assembly.get_EntryPoint()
       at Microsoft.VisualStudio.HostingProcess.HostProc.GetEntryPointAptThreadState(String assemblyFile)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunParkingWindowThread()
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()

Hopefully someone can help  :  )  This is great stuff Johnny!!  Love it - all my friends think I'm a huge geek!  ;  D


Offline enderq

  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Reply #1 on: March 20, 2008, 09:40:19 AM
Same setup here! I found the solution i searched for the exception on vista 64....
Good news, I found the solution! The only thing I had to do is to change the "Platform Target" to "x86" in the "Project\Properties" page, on the "Build" tab. This is required because "Managed DirectX does NOT support using 64 bit".

So in vis studio 2008 you need te go to build->configuration manager and use the cpu drop down and set it to x86.
« Last Edit: March 20, 2008, 09:41:57 AM by enderq »