I've been trying to deploy a c# console app that I made to a server. I have basically been copying the contents of the Release folder over to the server, and everything seems to work smoothly except for Oracle. On my development machine (32 bit XP) I have OracleClient 11.2, and the server (64 bit server 2008) has 11.1. The application works if I run it from on local machine.
When I deploy by just copying the Release folder and trying to run the application, I get the following error:
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Oracle.DataAccess, Version=2.111.7.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified.
File name: 'Oracle.DataAccess, Version=2.111.7.0, Culture=neutral, PublicKeyToken=89b483f429c47342'
at PDV.AODGateway.StoredProcedures..ctor()
at PDV.AODGateway.AODGateway.Export()
at PDV.AODGateway.AODGateway.Main(String[] args)
(don't read too much into it looking for the 111.7 version. It says that because I tried specifying in app.config to look for that version. Previously it said it couldn't find 112.1)
The section of code it is failing at is where I create an OracleConnection object.
If I try to copy the dll into the deployment folder from the server, I get a similar error:
Unhandled Exception: System.TypeInitializationException: The type initializer for 'PDV.AODGateway.StoredProcedures' threw an exception. ---> System.BadImageFormatException: Could not load file or assembly 'Oracle.DataAccess, Version=2.111.7.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. An attempt was made to load a program with an incorrect format.
File name: 'Oracle.DataAccess, Version=2.111.7.0, Culture=neutral, PublicKeyToken=89b483f429c47342'
at PDV.AODGateway.StoredProcedures..cctor()
I have eventually solved the problem by copying these files from the oracleclient folder on my development machine (i.e. the machine I used to build the solution) into the directory of the application on the server:
Oracle.DataAccess.dll
oci.dll
OraOps11w.dll
oraociei11.dll
However, this seems like extremely bad practice, so do any of you have suggestions on how I could get around having to do this? Have any of you run into this issue before?