Oracle Version Error
Last night, I struggled with the following error for a few hours:
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.
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=2.111.7.20, Culture=neutral, PublicKeyToken=89b483f429c47342′ or one of its dependencies. The system cannot find the file specified.
Development Machine Setup:
Windows 7 64 bit
Oracle 11g Release 1 (11.1.0.7.0)
Target Machine Setup:
Windows XP 32 bit
Originally Oracle 10g, now Oracle 11g (11.1.0.6.0)
After many grueling hours of searching the darkest corners of the internet, I found this post: ODP.NET & LLBLGen Pro. The author suggests using a binding redirect to fix a problem with LLBLGen Pro (but same basic error). While I am not exactly sure what is causing my problem, adding a binding redirect fixed it. The solution seems silly. I install Oracle 11g release 1 (11.1.0.7.0), which is what it is asking for and it still cannot be found.
I install Oracle 11g (11.1.0.6.0) and add the binding redirect and it works.
Here is my config:
<assemblyBinding xmlns=”urn:schemas-microsoft-com:asm.v1″>
<dependentAssembly>
<assemblyIdentity name=”Oracle.DataAccess” publicKeyToken=”89B483F429C47342″/>
<bindingRedirect oldVersion=”2.111.7.20″ newVersion=”2.111.6.0″/>
</dependentAssembly>
</assemblyBinding>
Note: Assembly redirection can work both ways. You can re-direct calls to a new version of the to an older installed version and vice-versa. You can read more about Binding Redirects on MSDN.
I hope this post can save someone a few headaches.