[.net] Could not load file or assembly for Oracle.DataAccess in .NET

When I try to run a simple program to access oracle I am getting this message

Could not load file or assembly 'Oracle.DataAccess, Version=2.111.7.20, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified.

I checked \windows\assembly and it's in there, but it's not in GAC (gacutil -l). I can't add into GAC (gacutil -i [path]. I get 'unknown error'.

Anyone has the same experiencing?

This question is related to .net oracle assemblies

The answer is


you can follow this

https://docs.oracle.com/health-sciences/inform-62/install/index.htm?toc.htm?214691.htm

Register the Oracle.DataAccess.dll assembly You must register the Oracle.DataAccess.dll assembly to the Global Assembly Cache (GAC) for .NET version 2 and version 4:

  1. Open a command prompt as an Administrator.

  2. Navigate to %ORACLE_CLIENT_HOME%\ODP.NET\bin\2.x.

  3. Execute the following command:: oraprovcfg.exe/action:gac/providerpath:Oracle.DataAccess.dll

  4. Navigate to %ORACLE_CLIENT_HOME%\ODP.NET\bin\4.x.

  5. Execute the following command: oraprovcfg.exe/action:gac/providerpath:Oracle.DataAccess.dll


I had the same issue.

Solution was to change the platform of my current solution to x64.

To do that in Visual Studio, right click solution > Configuration Manager > Active Solution Platform.


I switched over to the managed ODP.NET assemblies from Oracle. I also had to purge all the files from the IIS web apps that were using the older assemblies. Now I don't get any conflicts regarding 32 vs 64 bit versions when I debug in IIS Express vs IIS. See the following article.

An Easy Drive to .NET


As referred to in the first answer, there are 32/64 bit scenarios which introduce build and runtime pitfalls for developers.

The solution is always to try to get right: What kind of software and OS you have installed.

For a small list of scenarios with the Oracle driver and the solution, you can visit this post.


I'm going to give you the answers from what I've just went through on Windows Server 2008 R2 which is a 64 bit operating system. The application suite of libraries I was given were developed using .net 3.5 x86 with the older DLL libraries and I was stuck because I had installed the newer x64 clients from oracle.

What I found was the following: Install the latest x64 client from Oracle for Windows Server 2008. I believe this would be the 2.7.0 client. When you select the installation, make sure you do custom and select the .NET libraries. Configure your tnsnames files and test your tnsping against your data source.

Next, if you are running a 32 bit application, install the same version of the client for 32 bit. Also, follow the same installation routine, and select the same home.

When your finished, you will find that you have a single app/product with two client directories (Client1 and Client2).

If you navigate to the windows/assemblies directory you will find that you have a reference to the Oracle.DataAccess.dll (x2) with one for x86 and one for AMD64.

Now, depending on if you have developers or are developing on the machine yourself, you may be ok here, however, if they are using older drivers, then you need to perform one last step.

Navigate to the app\name\product\version\client_1\odp.net\publisher policy\2.x directory. Included in here are two policy files. use gacutil /i to install the Policy.2.111.Oracle.DataAccess.dll into the GAC. This will redirect legacy oracle ODP calls to the newer versions. So, if someone developed with the 10g client, it will now work with the 11 client.

FYI -- Some may be installing the latest ODP.NET with the 2.111.7.20. The main oracle client itself comes with 2.111.7.0 .. I've not had any success with the 7.20 but have no issues with the 7.0 client.


In my case the error states that the assemly

Oracle.DataAccess, Version=2.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342

is missing.

When I run gacutil.exe /l 'Oracle.DataAccess' the result was:

The Global Assembly Cache contains the following assemblies:
Oracle.DataAccess, Version=2.112.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=x86

Number of items = 1

At this moment I have just installed the oracle client: win32_11gR2_client

Then I installed oracle developer tools ODTwithODAC112030_deleloper_tool

Now gacutil is saying:

The Global Assembly Cache contains the following assemblies:
Oracle.DataAccess, Version=2.112.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=x86
Oracle.DataAccess, Version=2.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=x86

Number of items = 2

Fixed, one totally missing assembly case


please register your Oracle.DataAccess to GAC

raProvCfg.exe /action:gac /providerpath:C:\oracle\product\11.2.0\x32\ODP.NET\bin\4\Oracle.DataAccess.dll

OraProvCfg.exe /action:gac /providerpath:C:\oracle\product\11.2.0\x64\ODP.NET\bin\4\Oracle.DataAccess.dll

The solution is quite simple, it is all a matter of how you define things on the server / workstation in relation to your visual studio project.

First check the version of the Oracle library that you are using, in your case 2.111.7.20. Next go to the Windows GAC located in your windows home->assembly folder.

Scroll down to the Oracle dll, it is normally called Oracle.DataAccess or Oracle.Web. Find the right version of it and note down if it says x86 or AMD64.

In visual studio ensure that your target platform is the same as the dll in the GAC, so if it says x86 in the GAC folder ensure that the target platform is x64 and other x64. You can set this in Visual Studio project properties, under build/platform target.

Also ensure that your reference, under references in your project points to this exact same version on your development computer.

With this everything should work fine.

What I normally do is to check the server first as it is often easier in an enterprise environment to change the version of your local dependencies, then to ask a server administrator to do an installation of a different dll.


I was compiling in x64, just use x86 and it will solve the problem


Try the following: In Visual Studio, go to Tools/Options....Projects and Solutions...Web Projects... Make sure that 64 bit version of IIS Express checkbox is checked off.


I was facing the same issue for a couple of days then I figure out that the Oracle.DataAccess is available in the references list of the project, but in the bin folder is missing. So I removed it from the references list and readded again.


in your .net project go to reference section, right click on Oracle.DataAccess dll, goto properties.

Change the setting to "Specific Version=False". Now it will be no version conflict


Examples related to .net

You must add a reference to assembly 'netstandard, Version=2.0.0.0 How to use Bootstrap 4 in ASP.NET Core No authenticationScheme was specified, and there was no DefaultChallengeScheme found with default authentification and custom authorization .net Core 2.0 - Package was restored using .NetFramework 4.6.1 instead of target framework .netCore 2.0. The package may not be fully compatible Update .NET web service to use TLS 1.2 EF Core add-migration Build Failed What is the difference between .NET Core and .NET Standard Class Library project types? Visual Studio 2017 - Could not load file or assembly 'System.Runtime, Version=4.1.0.0' or one of its dependencies Nuget connection attempt failed "Unable to load the service index for source" Token based authentication in Web API without any user interface

Examples related to oracle

concat yesterdays date with a specific time ORA-28001: The password has expired how to modify the size of a column How to create a blank/empty column with SELECT query in oracle? Find the number of employees in each department - SQL Oracle Query to display all tablespaces in a database and datafiles When or Why to use a "SET DEFINE OFF" in Oracle Database How to insert date values into table error: ORA-65096: invalid common user or role name in oracle In Oracle SQL: How do you insert the current date + time into a table?

Examples related to assemblies

Could not load file or assembly for Oracle.DataAccess in .NET How can I get the assembly file version How to extract an assembly from the GAC? How to Load an Assembly to AppDomain with all references recursively? Can I load a .NET assembly at runtime and instantiate a type knowing only the name? How do I list all loaded assemblies? "Are you missing an assembly reference?" compile error - Visual Studio How can I reference a dll in the GAC from Visual Studio? How to fix "Referenced assembly does not have a strong name" error? How can I determine if a .NET assembly was built for x86 or x64?