【问题标题】:TFS Build: Referencing different version of Oracle than what's on the buyild serverTFS 构建:引用的 Oracle 版本与构建服务器上的不同
【发布时间】:2013-04-19 06:41:23
【问题描述】:

简短的故事:使用 TFS 2010,我无法使用目标服务器上需要的特定版本的 Oracle.DataAcess 来构建构建服务器。

此时,我们为整个企业提供了一个构建服务器,其中混杂了 Oracle、.Net 和 OS 版本。我正在构建的项目是用于具有与构建服务器上的不同版本的 Oracle.DataAccess.dll 的服务器。如果我在本地机器上构建它并部署到开发服务器,它工作正常。但我似乎无法让构建服务器忽略它的客户端版本并使用我的。

我已经阅读了几个很好的问题和答案,例如 pantelif 回答的问题: Solution.metaproj error MSB3202: The project file 'xxx' was not found

我认为我做的一切都是正确的。我什至在我的项目中包含一个 Ref 文件夹,并从那里直接引用 .dll。所以我不想从其他位置引用 .dll。

如果我设置 Specific Version = false,我会收到一个运行时 Oracle 错误,告诉我 Oracle 客户端的版本是错误的。如果我手动将正确版本的 .dll 复制到 bin 文件夹中,我会收到运行时错误,指出程序集的目标版本不同。

如果我设置 Specific Version = true,构建服务器会说找不到 .dll

Class\ProvData.cs (7): The type or namespace name 'Oracle' could not be found (are you missing a using directive or an assembly reference?)
 C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets (1360): Could not resolve this reference. Could not locate the assembly "Oracle.DataAccess, Version=1.102.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.

当我查看我的项目文件时,我看到了我的预期:

<Reference Include="Oracle.DataAccess, Version=1.102.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342">
  <HintPath>Ref\Oracle.DataAccess.dll</HintPath>
  <Private>True</Private>
</Reference>

那么关于为什么构建服务器仍然说它找不到它的任何想法?

【问题讨论】:

    标签: .net tfs tfsbuild odp.net


    【解决方案1】:

    您的构建服务器似乎与您的开发机器没有相同版本的Oracle.DataAccess

    你可以试试:

    • 使用 lib 引用模式,您的项目引用特定源代码控制位置中的文件:

      <Reference Include="Oracle.DataAccess, Version=1.102.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342">
        <HintPath>..\..\Lib\ODP.NET\1.102.3.0\Oracle.DataAccess.dll</HintPath>
      </Reference>
      
    • 从其定义中删除 FQN,(允许 CLR 选择任何匹配的版本):

      <Reference Include="Oracle.DataAccess" />
      
    • 通过使用 gacutil /i 将其部署到 GAC 来确保构建服务器具有相同的程序集版本:

      gacutil /i Oracle.DataAccess.dll
      

    【讨论】:

      猜你喜欢
      • 2014-07-10
      • 1970-01-01
      • 2013-02-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-04
      相关资源
      最近更新 更多