Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Oracle.DataAccess version could not load

Tags:

c#

oracle

wpf

I am having trouble with Oracle.DataAccess in WPF. I used Oracle.DataAccess v4.0 without any problems. But now it updated to version 4.112 and when I add reference to this version in WPF the designer could not be loaded. It gives me the following error:

System.BadImageFormatException
Could not load file or assembly 'Oracle.DataAccess, 
Version=4.112.3.0, Culture=neutral, 
PublicKeyToken=89b483f429c47342' or one of its dependencies. 
An attempt was made to load a program with an incorrect format.

Please note that program runs without any problem. I read that it can be due to "target cpu" in properties. I tested both x64 and x86 but nothing changes. How can I solve this problem. Thanks in advance

like image 599
Adil Mammadov Avatar asked Sep 22 '12 05:09

Adil Mammadov


People also ask

Could not load a file or assembly?

Http 5.2. 0.0? In summary if you get the "Could not load file or assembly error", this means that either your projects or their references were built with a reference to a specific version of an assembly which is missing from your bin directory or GAC.

What is Oraprovcfg EXE?

OraProfCfg.exe is a platform-independent (?) (AnyCPU) tool to configure ODP.NET drivers (managed and unmanaged). There are two versions of this executable, one is located under _arch = x86 and one under _arch = x64 .


2 Answers

The problem was with my Oracle.DataAccess.dll file. I have downloaded ODAC 11 XCopy and copied Oracle.DataAccess.dll from \odp.net4\odp.net\bin\4 to my OracleClient's \odp.net\bin\4 folder and replaced dlls. Now it works like a charm.

Hope it will be helpful to someone else

like image 72
Adil Mammadov Avatar answered Oct 21 '22 15:10

Adil Mammadov


I faced same issue I solved by putting dependencies DLL to Oracle.DataAcces. check this link What is the minimal setup required to deploy a .NET application with Oracle client 11?

Hope It should help.

like image 28
Jignesh Thakker Avatar answered Oct 21 '22 13:10

Jignesh Thakker