I have a .net exe program which is using Oracle.DataAccess, Version=2.121.1.0 dll. My development machine and tfs build server both are 32-bit. Everything is working fine on 32 machines. But now I have to migrate this program on x64 (Windows Server 2012 R2) and my all problems started from there. I am getting the famous error Could not load file or assembly 'Oracle.DataAccess, Version=2.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies..
I googled a lot and tried various things so far:
- Specifically build the executeble to target X86 platform by changing the project properties Compile option
- I have installed the Oracle dll on the machine and it's successfully registered in the GAC
- Tried to build the executable to target 'Any CPU' and when it didn't work tried X64 as well
- Specifically supplied the assembly binding information in app.config file to look at the exact place for loading the dll.
- Turned on the Fusion log to see the exact failure cause
Please see the error log below:
29/01/2015 10:57:30;ALERT ;System.Exception caught in Main() 29/01/2015 10:57:30;ERROR ;System.BadImageFormatException: Could not load file or assembly 'Oracle.DataAccess, Version=2.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. An attempt was made to load a program with an incorrect format. File name: 'Oracle.DataAccess, Version=2.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342' at XXXX.Common.Components.OraDataAccess..ctor() at XXXX.Library.ValuesCore.ValuesCore..ctor() at XXXX.Library.DerivationsCore.Derivations..ctor() at XXXX.Processes.XXXX.Main.Main() === Pre-bind state information === LOG: User = XX LOG: DisplayName = Oracle.DataAccess, Version=2.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342 (Fully-specified) LOG: Appbase = file:///D:/Release/ LOG: Initial PrivatePath = NULL Calling assembly : XXXX.CommonComponents, Version=1.0.0.0, Culture=neutral, PublicKeyToken=e9b31bf34182bd8b. === LOG: This bind starts in default load context. LOG: Using application configuration file: D:\Release\XXXX.exe.Config LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v2.0.50727\config\machine.config. LOG: Post-policy reference: Oracle.DataAccess, Version=2.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342 LOG: Attempting download of new URL file:///C:/Oracle/odp.net/bin/2.x/Oracle.DataAccess.dll. ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated. 29/01/2015 10:57:30;ERROR ;Could not load file or assembly 'Oracle.DataAccess, Version=2.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. An attempt was made to load a program with an incorrect format. 29/01/2015 10:57:30;ALERT ;(Global) Point Source ID = 0, Calc Time = 29/01/2015 10:57:30. 29/01/2015 10:57:30;STOP ;
Any help would is desparately needed and will be greatly appreciated.
Thanks