Wednesday, March 21, 2012

FileNotFoundException: Could not load file orassembly 'Oracle.DataAccess'

Wednesday, March 21, 2012 Posted by Unknown , ,
When running Oracle Applications on other machines as development, we run into problems with different versions of oracle client installations. This will result in the following error:
FileNotFoundException: Could not load file or assembly 'Oracle.DataAccess, Version=, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies

One solution is to look in the c:\windows\assemblies folder to look what version of oracle assemblies are installed. Now you can create a redirect in the app.config or web.config by adding the following piece of code after the <configSections> :

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

In line 5 you can give the oldVersion (or a range of versions) and the newVersion (which is the version installed in the Global Assembly Cache (c:\windows\assemblies))
You can add more redirects for other assemblies if you want.