I came across “System.BadImageFormatException” error while trying to migrate an application from Windows Server 2008 R2 to Windows Server 2012 R2. I will list possible root cause and solution for this issue in this post.
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.
If your application uses Oracle database, you will need to install the appropriate version of Oracle Client in your local machine. As this software keeps being updated, you may find yourself trying to uninstall old versions from your system after a while. The question is that how to find which versions of Oracle Client you have in Windows?
Finding out which Oracle Client you installed it’s not straightforward. You can check PATH variables or run some commands in SQLPLUS or TNSPING. Another approach is using OPatch Utility. In this post, I will talk about a much easier way to Oracle Client versions.
Oracle Client versions
Simply run the query below in the Command Prompt. It will call PowerShell first and search for oraclient*.dll files (Asterisk is used to represent the number such as 10, 11 or 12). Once the query is executed, a nicely formatted table will be displayed with the versions and their paths.