Search code examples
c#.net-4.0.net-4.5odp.net

ODP Oracle.DataAccess was working with .NETFramework 4.5 but not with .NET Framework 4.0


In my application, i'm connecting to an Oracle DB via ODP. I was using .NET 4.5 and everything was working fine but then for Windows XP compatibility i changed framework to .NET 4.0 on all the projects on my solution. Application is built on .NET 4.0 succesfully but can not connect to DB via ODP and throws exception:

Could not load file or assembly 'Oracle.DataAccess, Version=2.112.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. An attempt was made to load a program with an incorrect format.

I had created a References folder in Solution folder(near projects) and adding the Oracle.DataAccess.dll file as reference from there to the projects those use it. May it be the problem?


Solution

  • In the main(winforms) project of the solution i changed the platform target from any CPU to x86 and now it's working on .NET 4.0.