Reputation: 73
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"
Compilation is OK but when I run the code it says it can't find the assembly. Unchecking "prefer 32-bit" solves this problem.
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.
Any ideas?
Upvotes: 0
Views: 751
Reputation: 6876
"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.
You can read more about the "Prefer 32-bit" setting here: https://stackoverflow.com/a/12066861/631802
Upvotes: 1