[c#] The provider is not compatible with the version of Oracle client

This issue could by happen while using unmanaged oracle reference if you have more than one oracle client , or sometimes if you reference different version
There is two way to solve it :

  1. First and fast solution is to remove unmanaged reference and use the managed one from NuGet see this before to go with this option Differences between the ODP.NET Managed Driver and Unmanaged Driver

  2. Second solution is to fix project unmanaged target version like the below :

  • First Check oracle project reference version (from project references/(dependencies > assemblies ) > Oracle.DataAccess right click > properties):

    enter image description here

    enter image description here

Then check oracle GAC version

  • got to gac from run (Win+R) "%windir%\Microsoft.NET\assembly"
    enter image description here

  • Check the platform that matches with you project platform

    enter image description here

  • to check you target platform (right click on your project > properties)

    enter image description here

  • From gac folder search to Oracle.DataAccess

    enter image description here

  • Right Click on Oracle.DataAccess > properties > details and check version

    enter image description here

  • if you notice the versions are different this is an the issue and to fix it we need to redirect assembly version (in startup project go to config file and add the below section )

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Oracle.DataAccess" publicKeyToken="89b483f429c47342" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="4.121.2.0" />
      </dependentAssembly>
</assemblyBinding>

like this enter image description here

oldVersion : should be cover your project version newVersion : GAC version publicKeyToken : From GAC

enter image description here

Examples related to c#

How can I convert this one line of ActionScript to C#? Microsoft Advertising SDK doesn't deliverer ads How to use a global array in C#? How to correctly write async method? C# - insert values from file into two arrays Uploading into folder in FTP? Are these methods thread safe? dotnet ef not found in .NET Core 3 HTTP Error 500.30 - ANCM In-Process Start Failure Best way to "push" into C# array

Examples related to asp.net

RegisterStartupScript from code behind not working when Update Panel is used You must add a reference to assembly 'netstandard, Version=2.0.0.0 No authenticationScheme was specified, and there was no DefaultChallengeScheme found with default authentification and custom authorization How to use log4net in Asp.net core 2.0 Visual Studio 2017 error: Unable to start program, An operation is not legal in the current state How to create roles in ASP.NET Core and assign them to users? How to handle Uncaught (in promise) DOMException: The play() request was interrupted by a call to pause() ASP.NET Core Web API Authentication Could not load file or assembly 'CrystalDecisions.ReportAppServer.CommLayer, Version=13.0.2000.0 WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for jquery

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 odp.net

The type initializer for 'Oracle.DataAccess.Client.OracleConnection' threw an exception The provider is not compatible with the version of Oracle client ORA-03113: end-of-file on communication channel after long inactivity in ASP.Net app Can you use Microsoft Entity Framework with Oracle?

Examples related to oracleclient

sqlplus: error while loading shared libraries: libsqlplus.so: cannot open shared object file: No such file or directory Error System.Data.OracleClient requires Oracle client software version 8.1.7 or greater when installs setup How to know installed Oracle Client is 32 bit or 64 bit? Why do I get java.lang.AbstractMethodError when trying to load a blob in the db? The type initializer for 'Oracle.DataAccess.Client.OracleConnection' threw an exception The provider is not compatible with the version of Oracle client