My config: Vs2015 / X64 PC / ODP.NET X86
I've wrote a few DLL on 'Any Cpu' mode and I would like to write programs that use this DLLs and that can be work on X64 and X86 machins.
But I referenced "Oracle.DataAccess.dll" in my Dlls then I've a warning 'ProcessorArchitecture=X86' on Oracle DLL.
How can I do (I can install ODP.NET X64 if necessary) ?
thks
When you compile your DLL with "x86" then also the Oracle.DataAccess.dll
must be the x86 version (i.e. 32 bit version)
When you compile your DLL with "x64" then also the Oracle.DataAccess.dll
must be the x64 version (i.e. 64 bit version)
For "AnyCPU" it depends, there is no "AnyCPU" version of Oracle.DataAccess.dll
. If your application runs on 64-bit Windows it will run as x64 process - thus also Oracle.DataAccess.dll
must be the x64 version. If your application runs on 32-bit Windows it will run as x86 process - thus also Oracle.DataAccess.dll
must be the x86 version.
To cut a long story short: architecture of Oracle.DataAccess.dll
must be the same as the application, i.e. your DLL.
Follow this instruction to run both in parallel: BadImageFormatException. This will occur when running in 64 bit mode with the 32 bit Oracle client components installed
Update
In your *.csproj
, resp. *.vbproj
edit your reference to ODP.NET like this:
<Reference Include="Oracle.DataAccess">
<SpecificVersion>False</SpecificVersion>
<Private>False</Private>
</Reference>
Attributes like Version=...
or processorArchitecture=...
are not required. Your application will load the correct Oracle.DataAccess.dll
depending on selected architecture and target .NET framework (provided that it is installed properly)