我有一個.NET 3.5程序集引用ODP(Oracle.DataAccess.dll),在Visual Studio 2010中構建。Copy Local = False,特定版本爲false。路徑爲ODP Oracle.DataAccess.DLL參考32/64位
C:\[ORACLE_BASE]\product\11.2.0\client_1\ODP.NET\bin\2.x\Oracle.DataAccess.dll
該版本是2.112.3.0,(運行時v.2.0.50727)。我的開發機器上安裝了ODAC 11.2.0.3.0 x86。當我構建這個項目並在集成測試中測試它時,一切正常,並且ODP被加載和使用。我試圖在Team Server 7上使用MSBuild(通過Team City)在Windows Server 2003 x64機器上構建相同的集成測試。該機器安裝了相同版本的ODAC,但爲x64版本。
嘗試加載Oracle.DataAccess.dll時出現問題。它似乎正在尋找.NET 2版本,但首先找到.NET 4版本,然後不可避免地失敗。看着日誌,它發現了.NET 4的版本,但仍然無法解析引用,並且似乎明確地尋找x86版本。 MSBuild的配置爲: MSBUILD版本:.NET 4.0 運行平臺x86。
CSProject參考:
<Reference Include="Oracle.DataAccess, Version=2.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=x86" />
(我試圖改變運行平臺,X86,而且似乎接受Oracle.DataAccess.DLL庫,但抱怨說,所有其他的核心.NET庫指定了錯誤。平臺,如mscorlib中
我也想通過它使用的MSBuild建設項目的解決方案,並獲得類似問題耙腳本做構建
問題: 如何才能在我的x64機器上正確構建? x86和x64版本的庫具有相同的PublicKeyToken,所以不應該起作用? CSProj中的引用標籤可以設置爲「任何CPU」而不是顯式x64(通過手動編輯文件)?或者,有沒有辦法根據構建機器的體系結構設置一個有條件地引用庫的方法,如here(不完全確定問題是什麼,但這可能是一個解決方案)?
[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:
在我的機器上,我只有AMD64的版本2.112.3.0和4.112.3.0。 x64沒有在那裏列出。你的意思是app.config不是machine.config,還是需要在機器的配置上完成?我將CSPRoj設置爲不查找特定版本,所以不應該覆蓋machine.config更改? – 2012-02-29 12:49:30
對於使用MSBUild(不是rake腳本)的teamcity bulid,將其設置爲.NET 3.5 for MSBuild會導致其他程序集無法生成,表明它無法找到LINQ。這讓我感到困惑,因爲LINQ在.NET 3.5中 – 2012-02-29 13:06:21
看來您可能已經安裝了ODAC 32位和64位?另外,在我的第一個評論中,我的意思是在第二句中說「x86不在那裏」。現在無法編輯它。 – 2012-02-29 13:37:32