ODP.NET x64 ANYCPU 和首选 32 位设置 [英] ODP.NET x64 ANYCPU and Prefer 32-bit setting

查看:119
本文介绍了ODP.NET x64 ANYCPU 和首选 32 位设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的机器安装了最新的 Oracle ODP.NET x64(xCopy 版本).我的机器是 x64.我不知道目标机器是 x86 还是 x64,所以我在 VS 2012 中将构建属性设置为 AnyCPU.有一个默认复选框处于活动状态首选 32 位"

My machine has the latest Oracle ODP.NET x64 installed (xCopy version). My machine is x64. I don't know if the target machines will be x86 or x64 so I have set the build properties to AnyCPU in VS 2012. There is a default checkbox active "prefer 32-bit"

编译没问题,但是当我运行代码时,它说找不到程序集.取消选中首选 32 位"可解决此问题.

Compilation is OK but when I run the code it says it can't find the assembly. Unchecking "prefer 32-bit" solves this problem.

这是什么原因造成的?我认为首选 32 位是可以的,但如果这是唯一的选择,它将使用 x64.

But what is causing this? I would assume that prefering 32-bits is okay but that it would use x64 if that's the only option.

有什么想法吗?

推荐答案

带有Prefer 32-bit"的Any CPU"将在 64 位机器上作为 32 位进程运行.并且由于 32 位进程无法加载 64 位 ODP.NET 程序集(以及本机 DLL),因此它会引发您提到的异常.

"Any CPU" with "Prefer 32-bit" will run as a 32-bit process on 64-bit machines. And because a 32-bit process can't load the 64-bit ODP.NET assemblies (and native DLLs too), it throws the exception you mentioned.

您可以在此处阅读有关首选 32 位"设置的更多信息:https://stackoverflow.com/a/12066861/631802

You can read more about the "Prefer 32-bit" setting here: https://stackoverflow.com/a/12066861/631802

这篇关于ODP.NET x64 ANYCPU 和首选 32 位设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆