开发者

Oracle Visual Studio dev on x64 box, targeting x86, getting incorrect format error

开发者 https://www.devze.com 2023-02-08 09:14 出处:网络
I am writing a Windows Service that needs to make a call to an Oracle Database.I have the target environment set for .Net 2.0 and x86 for the compiler.I 开发者_JS百科referenced the Oracle.DataAccess.d

I am writing a Windows Service that needs to make a call to an Oracle Database. I have the target environment set for .Net 2.0 and x86 for the compiler. I 开发者_JS百科referenced the Oracle.DataAccess.dll file on my 11.2.0 client for oracle. If i copy it into the GAC, it shows as x86 architecture.

Now, whenever i try to compile the service, I get an "Attempt to load a program with an incorrect format" error. It shows as being in the service's resx file as well as the ServiceInstaller resx file.

This happens regardless of if i target the x86 or x64 platform. Also regardless of setting the DLL to copy local or not. Any idea what is wrong?


ODP.NET is not fully managed, so it calls out to 32 bit unmanaged supporting DLLs (if you installed 32-bit ODAC) or to 64-bit unmanaged supporting DLLs (if you installed 64-bit ODAC).

So first, you need to get the target set correctly, then you need to make sure the right flavor of Oracle DLLs are being picked up.

In this case you chose x86 (32 bit) which means you also need to install 32-bit ODAC AND make sure that you aren't referencing the 64-bit Oracle dlls by mistake.

Christian Shay
Oracle

0

精彩评论

暂无评论...
验证码 换一张
取 消