Oracle Dll Load error: unable to run C# console applicatin on a different machine

0

I have developed a C# console application(.NET 4.5.2) on my Windows

8.1(64 bit machine). I used Visual Studio 2015(the only available option as we don't have licenses for newer)

I need to access Oracle (11G) database for my application.

My requirement is that my application should run on a clean machine,means no Oracle client installed and a DLL should be enough to access the database(like we do with Java

JDBC jars)

As I already mention I developed and built my app on Windows 8.1 (64

bit) with x64 in the visual studio 2015 build config

I used Oracle.DataAccess for DB access and I simply added Oracle.Web

also in the references. Everything works properly on my machine.

Now when I try to run the built application(exe with all the dlls in

the same folder) on a windows Vista(64 bit machine) I get the following error.

D:\distribution_C#_x64>EAS_Background_Alert.exe Unhandled Exception: System.TypeInitializationException: The type initializer fo r 'Oracle.DataAccess.Client.OracleConnection' threw an exception. ---> System.Dl lNotFoundException: Unable to load DLL 'OraOps12.dll': The specified module coul d not be found. (Exception from HRESULT: 0x8007007E) at Oracle.DataAccess.Client.OpsInit.CheckVersionCompatibility (String version) at Oracle.DataAccess.Client.OracleInit.Initialize() at Oracle.DataAccess.Client.OracleConnection..cctor() --- End of inner exception stack trace ---

I have the following dlls in the folder 1. oci.dll 2. ociw32.dll 3. Oracle.DataAccess.dll 4. Oracle.Web.dll 5. oramts.dll 6. oramts12.dll 7. oramtsus.dll 8. orannzsbb12.dll 9. oraocci12.dll 10. oraociei12.dll 11. oraons.dll 12. OraOps12.dll

I copied these DLLs from the ODAC(oracle data access client folders

intalled on my machine)

Can Anyone help?

[Note: Just thought to mention , my application generates pdf reports

and I also have itextsharp.dll in the folder(and it works fine on my

machine)]

Also, today I tried to run it on Windows Vista, tomorrow it can be

Windows 7. So, how can I make sure that a built application runs properly on

all machines.

c#
oracle
dll
asked on Stack Overflow May 16, 2019 by Rohit Ganeshan • edited May 16, 2019 by Rohit Ganeshan

1 Answer

0

Looks like you did not install the Oracle Instant client (or any other version of Oracle Client). This is a prerequisite.

Here's another link

Download, unzip, then ref it in your project (Copy Local: True)

answered on Stack Overflow May 16, 2019 by JohnB

User contributions licensed under CC BY-SA 3.0