DirectX BadImageFormatExceptions
Hi all,
i try to compile and run my solutions with Visual c# 2005 Express on Windows XP Pro 64bit. Which works fine on my Windows Xp Pro machine, but throws BadImageFormatExceptions on my 64bit OS. I tried DirectX and SDL .NET... it seems like the DLLs are not valid... cant find any help on MSDN or on the net. Please help me!
Thanks, Marre
Mario:
The likely reason for the BadImageFormatException is that you are compiling your project as "Any CPU" or agnostic and it is running against the CLR64. The DirectX dependencies are 32bit assemblies, so that will fail to load.
To correct this issue you will need to build your project for "X86". To do this create a new Platform type for X86.
Build -> Configuration Manager
In "Active solution manager" select "<new>"
Select "X86" in "Type or select new platform"
Set "Copy settings from" to "Any CPU"
Check "create new project platforms"
OK
This will force your application to run under the WOW64.
Hope that this helps.
Jeff
I half understand what is happening here, but would like to understand the other half so I can avoid problems in the future.
What makes an assembly require the x86 framework? No assembly I have created seems to require this.
Also, is there a config file setting that can cause an assembly which was compiled agnostically to run properly?