BadImageFormatException while using Oracle Client 64 bit and Visual Studio 2010!

Same problem you may face also in Visual Studio 2013 and 64-bit Oracle Client (11 and 12 versions). My solution is:

a) Desktop project. Project properties > Build > disable 'Prefer 32-bit' checkbox.

b) ASP.NET project or web site. Main menu > TOOLS > Options > Project and Solutions > Web Projects > enable 'Use the 64 bit version of IIS Express for web sites and projects' checkbox.


I have seen this a couple of times recently when running Visual studio on a 64Bit O/S. A simple workround is to install the 32bit client on your 64Bit development machine.

Regards, Pete


I am sorry about adding a second answer but if you have 64 bit and 32 bit clients installed in the same machine you may encounter this problem too.

Two clients installed

C:\oracle\product\11.2.0\client32Bit
C:\oracle\product\11.2.0\client64Bit

Control your path Environment Variable. Which Oracle client is first, it is loaded before other one.

 echo %PATH%
 XXXX;C:\oracle\product\11.2.0\client64Bit\BIN;XXX

Since my 64bit Oracle Client is first in PATH, VS.NET tries to use it for Oracle Connections and throws Bad Image Exception.

  set PATH=C:\oracle\product\11.2.0\client32Bit\BIN;%PATH%
  REM Visual Studio 2008
  "C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe"
  REM Visual Studio 2010
  "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe"

After this you can connect oracle. Of course you can put 32Bit client first in path but I prefer to put 64 bit client before 32 bit for other applications.