Depending on your environment, getting an app running on a production server can sometimes be a daunting task. Generally, the less you have to configure, the better. So when you need to deploy an application that uses Oracle.DataAccess and the right version of Oracle isn’t installed, good luck!
We shouldn’t blame the server admins. Maybe they are overloaded with tasks and simply don’t have the time, or maybe they’re worried that installing a new version of Oracle will break other functionality. Whatever the case, we have to understand their position.
Anyway, I had a similar situation with a recent .NET project I was working on. Fortunately, after doing a bit of research (and being very stubborn), I found a fantastic approach that requires no installation of Oracle on the production machine whatsoever. You simply copy a few *.dlls into your project, push the build, and watch the application run.
The below steps are using ODAC 11.2 Release 3 (11.2.0.2.1):
- Install the latest version of ODAC on your development machine.
- From your oracle client home, grab
oci.dllandoraociei11.dll. - From the \bin folder inside your oracle client home, grab
OraOps11w.dll. - Add the above three .dlls to your Visual Studio project.
- From the properties window, make sure that the Build Action is set to Content and the Copy to Output Directory is set to Copy if newer.
- Make sure your project is referencing
Oracle.DataAccess, which it should be anyway if you’re using ODAC in your project. - The Copy Local property for
Oracle.DataAccessshould be set to True.
That’s it! Push your project, and you should see a total of four Oracle-related .dll files get copied into your output folder. Give this to your server admins and tell them you knocked one item off their todo list ;-)
Note: oraociei11.dll is approximately 120MB, which stinks, but isn’t a bad sacrifice to make.
If your team needs to do this on a large number of projects, you could do something neat like create a local NuGet package. I have a blog post about this coming soon.
Credits:
