I have a .NET 3.5 assembly that references ODP (Oracle.DataAccess.dll), building in Visual Studio 2010. Copy Local = False, Specific Version is false. The path is
C:\[ORACLE_BASE]\product\11.2.0\client_1\ODP.NET\bin\2.x\Oracle.DataAccess.dll
The version is 2.112.3.0, (Runtime v.2.0.50727). I have ODAC 11.2.0.3.0 x86 installed on my development machine. When I build this project and test it in an integration test, everything works fine and ODP is loaded and used. I'm trying to build the same integration test on Team City 7, on a Windows Server 2003 x64 machine, using MSBuild (via Team City). This machine has the same version of ODAC installed, but the x64 version.
There's a problem trying to load up the Oracle.DataAccess.dll. It seems that it's looking for the .NET 2 version, but first finds the .NET 4 version, and then inevitably fails. Looking at the logs, it finds the .NET 4 version, but still can't resolve the reference and appears to explicitly be looking for the x86 version. The configuration for MSBuild is: MSBUILD Version: .NET 4.0 Run Platform x86.
CSProject reference:
<Reference Include="Oracle.DataAccess, Version=2.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=x86" />
(I tried changing the Run Platform to x86, and seems to accept the Oracle.DataAccess.DLL library, but complains that all the other core .NET libraries are targeting the wrong platform, e.g. mscorlib
I'm also trying to do a build via a rake script which uses msbuild to build the project solution, and get similar issues.
Questions: How can I get this to build properly on my x64 machine? The x86 and the x64 versions of the libraries have the same PublicKeyToken, so shouldn't it work? Can a Reference tag in a CSProj be set to target "Any CPU" rather than explicitly x64 (by manually editing the file)? Or, is there some way to set up a way to conditionally reference a library depending on the build machine's architecture, as shown here (not exactly sure what the problem is, but this might be a solution)?
[14:30:09]PrepareForBuild:
[14:30:09] Creating directory "bin\Debug\".
[14:30:09]ResolveAssemblyReferences:
[14:30:09] Unified primary reference "Oracle.DataAccess, Version=4.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=x86".
[14:30:09] Using this version instead of original version "2.112.3.0" in "D:\TeamCity\buildAgent\work\f2ad3a714cc001ba\Source\MyProj\MyProj.Data.Oracle\bin\Debug\MyProj.Data.Oracle.dll" because AutoUnify is 'true'.
[14:30:09]C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Oracle.DataAccess, Version=4.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=x86". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [D:\TeamCity\buildAgent\work\f2ad3a714cc001ba\Source\MyProj\MyProj.IntegrationTests\MyProj.IntegrationTests.csproj]
[14:30:09] For SearchPath "D:\TeamCity\buildAgent\work\f2ad3a714cc001ba\Source\MyProj\MyProj.Data.Oracle\bin\Debug".
[14:30:09] Considered "D:\TeamCity\buildAgent\work\f2ad3a714cc001ba\Source\MyProj\MyProj.Data.Oracle\bin\Debug\Oracle.DataAccess.dll", but it didn't exist.
[14:30:09] Considered "D:\TeamCity\buildAgent\work\f2ad3a714cc001ba\Source\MyProj\MyProj.Data.Oracle\bin\Debug\Oracle.DataAccess.exe", but it didn't exist.
[14:30:09] For SearchPath "{TargetFrameworkDirectory}".
[14:30:09] Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Oracle.DataAccess.dll", but it didn't exist.
[14:30:09] Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Oracle.DataAccess.exe", but it didn't exist.
[14:30:09] For SearchPath "{Registry:Software\Microsoft\.NETFramework,v4.0,AssemblyFoldersEx}".
[14:30:09] Considered "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\x64\Oracle.DataAccess.dll", but it didn't exist.
[14:30:09] Considered "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\x64\Oracle.DataAccess.exe", but it didn't exist.
[14:30:09] Considered "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\Oracle.DataAccess.dll", but it didn't exist.
[14:30:09] Considered "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\Oracle.DataAccess.exe", but it didn't exist.
[14:30:09] Considered "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Itanium\Oracle.DataAccess.dll", but it didn't exist.
[14:30:09] Considered "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Itanium\Oracle.DataAccess.exe", but it didn't exist.
[14:30:09] Considered "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Oracle.DataAccess.dll", but it didn't exist.
[14:30:09] Considered "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Oracle.DataAccess.exe", but it didn't exist.
[14:30:09] Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\VSTA\v9.0\Oracle.DataAccess.dll", but it didn't exist.
[14:30:09] Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\VSTA\v9.0\Oracle.DataAccess.exe", but it didn't exist.
[14:30:09] Considered "C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PublicAssemblies\Oracle.DataAccess.dll", but it didn't exist.
[14:30:09] Considered "C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PublicAssemblies\Oracle.DataAccess.exe", but it didn't exist.
[14:30:09] Considered "C:\Program Files (x86)\Common Files\Microsoft Shared\MSEnv\PublicAssemblies\Oracle.DataAccess.dll", but it didn't exist.
[14:30:09] Considered "C:\Program Files (x86)\Common Files\Microsoft Shared\MSEnv\PublicAssemblies\Oracle.DataAccess.exe", but it didn't exist.
[14:30:09] Considered "D:\ODAC_Base\product\11.2.0\client_1\ODP.NET\bin\2.x\Oracle.DataAccess.dll", but its name "Oracle.DataAccess, Version=2.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342" didn't match.
[14:30:09] Considered "D:\ODAC_Base\product\11.2.0\client_1\ODP.NET\bin\2.x\Oracle.DataAccess.exe", but it didn't exist.
[14:30:09] Considered "C:\Program Files (x86)\Microsoft Chart Controls\Assemblies\Oracle.DataAccess.dll", but it didn't exist.
[14:30:09] Considered "C:\Program Files (x86)\Microsoft Chart Controls\Assemblies\Oracle.DataAccess.exe", but it didn't exist.
[14:30:09] Considered "D:\ODAC_Base\product\11.2.0\client_1\ASP.NET\bin\2.x\Oracle.DataAccess.dll", but it didn't exist.
[14:30:09] Considered "D:\ODAC_Base\product\11.2.0\client_1\ASP.NET\bin\2.x\Oracle.DataAccess.exe", but it didn't exist.
[14:30:09] For SearchPath "{AssemblyFolders}".
[14:30:09] Considered "C:\Program Files (x86)\Microsoft SQL Server\100\SDK\Assemblies\Oracle.DataAccess.dll", but it didn't exist.
[14:30:09] Considered "C:\Program Files (x86)\Microsoft SQL Server\100\SDK\Assemblies\Oracle.DataAccess.exe", but it didn't exist.
[14:30:09] Considered "C:\Program Files (x86)\Microsoft.NET\ADOMD.NET\100\Oracle.DataAccess.dll", but it didn't exist.
[14:30:09] Considered "C:\Program Files (x86)\Microsoft.NET\ADOMD.NET\100\Oracle.DataAccess.exe", but it didn't exist.
[14:30:09] Considered "C:\Program Files (x86)\Microsoft SQL Server\100\SDK\Assemblies\Oracle.DataAccess.dll", but it didn't exist.
[14:30:09] Considered "C:\Program Files (x86)\Microsoft SQL Server\100\SDK\Assemblies\Oracle.DataAccess.exe", but it didn't exist.
[14:30:09] Considered "C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Tasks\Oracle.DataAccess.dll", but it didn't exist.
[14:30:09] Considered "C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Tasks\Oracle.DataAccess.exe", but it didn't exist.
[14:30:09] Considered "C:\Program Files (x86)\Microsoft SQL Server\100\DTS\PipelineComponents\Oracle.DataAccess.dll", but it didn't exist.
[14:30:09] Considered "C:\Program Files (x86)\Microsoft SQL Server\100\DTS\PipelineComponents\Oracle.DataAccess.exe", but it didn't exist.
[14:30:09] Considered "c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\Oracle.DataAccess.dll", but it didn't exist.
[14:30:09] Considered "c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\Oracle.DataAccess.exe", but it didn't exist.
[14:30:09] Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0\Oracle.DataAccess.dll", but it didn't exist.
[14:30:09] Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0\Oracle.DataAccess.exe", but it didn't exist.
[14:30:09] Considered "C:\Program Files (x86)\Microsoft SQL Server\100\DTS\ForEachEnumerators\Oracle.DataAccess.dll", but it didn't exist.
[14:30:09] Considered "C:\Program Files (x86)\Microsoft SQL Server\100\DTS\ForEachEnumerators\Oracle.DataAccess.exe", but it didn't exist.
[14:30:09] For SearchPath "{GAC}".
[14:30:09] Considered "Oracle.DataAccess, Version=4.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=x86", which was not found in the GAC.
[14:30:09] For SearchPath "bin\Debug\".
[14:30:09] Considered "bin\Debug\Oracle.DataAccess.dll", but it didn't exist.
[14:30:09] Considered "bin\Debug\Oracle.DataAccess.exe", but it didn't exist.
[14:30:09]GenerateTargetFrameworkMonikerAttribute:
I had the same issue. The problem was in the MsBuild version on the server. I used Msbuild 4.0 and it is using v4.0 runtime instead of 2.0.xx used in MsBuild 3.5.
Try to use Msbuild 3.5 if possible. If not, check your GAC if you have ODP installed correctly. I don't remember exactly how I fixed it for MSBuild 4.0, but I had to play with GAC assemblies and machine.config.
This is my GAC listing for Oracle.DataAccess.dll on our 64bit build server:
This is the part of machine.config. I had to add assembly redirect:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Oracle.DataAccess" publicKeyToken="89B483F429C47342" culture="neutral" />
<bindingRedirect oldVersion="2.102.0.0-2.120.0.0" newVersion="2.112.2.0" />
</dependentAssembly>
<dependentAssembly>
</assemblyBinding>
</runtime>
I updated all machine.configs to be sure :) But updating Framework64 machine.config should be enough.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With