User M
User M

Reputation: 329

Different versions of ODAC causing error in C# application (local Vs Server)

I have built an application using C#. I had referenced ODAC version 4.121.2.0. When I deployed my application on the server, the application failed with error:

Unhandled Exception: System.BadImageFormatException: Could not load file or asse mbly 'Oracle.DataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b4 83f429c47342'. This assembly was compiled for a different processor.

The server only has 4.121.1.0 installed.

What do I need to do to make application work? Things I tried:

 1. In the .csproj <SpecificVersion>False</SpecificVersion>

 <Private>False</Private>

 2. I tried copying over the ODAC version (4.121.2.0) in the bin solution directory(of the server), it wouldn't work.
 3. I tried removing all ODAC dlls in folder, so that it can find out older version and use that for functionality.

I do not want to install older version on my local and then - I have tried this in the past and I ended up uninstalling all the versions.

Possible duplicates: Having two ODP.NET (ODAC) versions in the same server

How do I get an older version of OracleClient to work locally with .NET? oracleclient-to-work-locally-with-net

But these links didn't provide solution for my problem.

Upvotes: 0

Views: 257

Answers (1)

Itay Podhajcer
Itay Podhajcer

Reputation: 2656

I think the error your are getting is not related to a dependency versioning issue. A BadImageFormatException usually gets thrown when there are 32Bit/64Bit incompatibilities between the entry point (i.e. exe file) and one of the dependencies.

Try playing with the target platform when you compile the project(s) (Any CPU/x86/x64 and the Prefer 32-Bit project property).

Hope it helps!

Upvotes: 2

Related Questions