1

I have taken a perfectly working MDX piece of code to Windows 2008R2 (all DX drivers installed) and am getting the following, rather bizarre, error. Any idea what this could mean?

System.BadImageFormatException: Could not load file or assembly 'Microsoft.DirectX.Direct3D.dll' or one of its dependencies.  is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)
File name: 'Microsoft.DirectX.Direct3D.dll'
   at Nesteruk.MdxConsole.Console..ctor(Boolean fullScreen, Int32 charWidth, Int32 charHeight, Int32 windowWidth, Int32 windowHeight)
   at Nesteruk.MdxConsole.Console..ctor(Viewport viewport) in c:\Users\Dmitri.EUPHORIA\Projects\Open-Source\MdxConsole\MdxConsole\Console.cs:line 67
   at Nesteruk.MdxConsole.Console.NewConsole(Int32 width, Int32 height) in c:\Users\Dmitri.EUPHORIA\Projects\Open-Source\MdxConsole\MdxConsole\Console.cs:line 471
   at MdxConsoleDemo.Program.Everything() in c:\Users\Dmitri.EUPHORIA\Projects\Open-Source\MdxConsole\MdxConsoleDemo\Program.cs:line 51
   at MdxConsoleDemo.Program.Main() in c:\Users\Dmitri.EUPHORIA\Projects\Open-Source\MdxConsole\MdxConsoleDemo\Program.cs:line 30
Dmitri Nesteruk
  • 23,067
  • 22
  • 97
  • 166

2 Answers2

5

Is your operating system 64-bit? If yes, set Platform Target to x86 in Project Properties -> Build tab. MDX is 32-bit only, trying to load it into 64-bit process causes BadImageFormatException.

max
  • 33,369
  • 7
  • 73
  • 84
  • 1
    Thanks! The solution was to switch everything to x86 and to add the `useLegacyV2RuntimeActivationPolicy` attribute to App.config – Dmitri Nesteruk Jun 04 '10 at 19:14
1

without much more information...

1) Locate Microsoft.DirectX.Direct3D.dll
2) Try to open it with Reflector
3) Is it a managed assembly (it loads) or not (does not load)?