C# ODP.NET Load file or assembly

cnetodp.netoracle

I recently started testing on a C# (4.0) app that uses ODP.NET (Oracle.DataAccess 4.112.3)

I set this project to target any platform and publish the app.

When I run the program on the client machine I receive:

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

Like I said I've targeted 'Any CPU' and I've also embedded the Oracle.DataAccess assembly with the app.
I get this error on machines that have the Oracle client installed as well as machines that do not.

Any help is appreciated.

Best Answer

Like I said I've targeted 'Any CPU'

This is likely the problem.

The Oracle.DataAccess has separate versions for 32bit and 64bit systems. If you are developing on a 32bit machine, and then deploying on a 64bit OS, you will receive this message.

You could easily work around this by building your application to target x86, and deploying the 32bit version of the data access components.