C# – Could not load file or assembly ‘Oracle.DataAccess, Version=4.121.2.0 when Oracle 11 and 12 are installed

asp.netcodp.netoracle

On my local machine, witch I use for ASP.NET Web Development, I have several Oracle 11 Client (11.2.0.1, 11.2.0.2, 11.2.0.3). My website Use the Oracle.DataAccess.Dll (ODP.NET all 32bits)

I just installed the Oracle 12c ODPwithODAC package 32bits.

And now the website that use the Oracle.DataAccess.dll 11.2. doesn't work anymore. I have this error:

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

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.FileNotFoundException: Could not load file or assembly 'Oracle.DataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[FileNotFoundException: Could not load file or assembly 'Oracle.DataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified.]
Oracle.Web.Security.OracleMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved, String& salt, Int32& passwordFormat) +0
Oracle.Web.Security.OracleMembershipProvider.ValidateUser(String username, String password) +105
System.Web.UI.WebControls.Login.AuthenticateUsingMembershipProvider(AuthenticateEventArgs e) +59
System.Web.UI.WebControls.Login.OnAuthenticate(AuthenticateEventArgs e) +113
System.Web.UI.WebControls.Login.AttemptLogin() +119
System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e) +75
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +114
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +164

Best Answer

First, with the Oracle Home Selector, I Choose the Oracle Home that i wanted.

In Visual Studio, I set the property "Specific Version" to "false" on my "Oracle.DatabaseAccess" reference.

Property pane