Getting “BadImageFormatException” when attempting to connect through Visual Studio to Oracle

oracle

I get the following message: “Attempt to load Oracle client libraries threw BadImageFormatException. This problem will occur when running in 64 bit mode with the 32 bit Oracle client components installed.” when I attempt to create a connection from both Visual Studio 2008 and 2012 to Oracle from my Windows 8 64bit workstation.

I’m not running a web app when this message happens. I’m only trying to establish an Oracle connection with Visual Studio.
Any solutions posted on the internet that I have seen that resolve this issue with others, doesn’t seem to apply to my circumstances.

  • I did not have this issue when I was using Widows 7 64bit.
  • I have set the Active Solution Platform to both Any PC and x86 when I have a solution open, but I still get the same message with either setting.
  • I have the latest Oracle 32 bit Client since 64 bit Oracle client won’t work with 32 bit Visual Studio.
  • At this point, I am only trying to connect to Oracle from Visual Studio and not run a web application. So IIS settings have nothing to do with this issue.

My environment is

  • Windows 8 64bit
  • Visual Studio 2012 and 2008
  • Oracle 32 bit Client. But also tried 64 Bit Client.
  • Oracle 11.2.0.3 database.
  • Active Solution Platform was tried with both Any PC and x86.

Any suggestions would be appreciated.

Best Answer

I discovered the solution myself. I found that apparently when I had installed Oracle Client, it had installed on my external drive E the first time and became Oracle Home #1 in the Windows registry. I don't believe it was "looking" at the Oracle client I had installed on the C drive even though it was first in the path. I uninstalled the Oracle clients on both the C and E drive and reinstalled the client on the C drive. I am now able to connect to Oracle with Visual Studio.

Related Question