tfs - 在我的 dbproj 中,在文件上设置 «Copy always» 或 «Copy if newer» 会使构建服务器上的构建失败

标签 tfs msbuild tfsbuild dbproj

在 VisualStudio 2010 中,我们有一个场景,其中一个 dbproj (B) 引用另一个 dbproj (A)。

在 dbproj (A) 中,如果我将 Scripts 文件夹中的自定义 sql 脚本之一的构建操作设置为 «Copy always» 或 «Copy if newer» 构建 dbproj (B) 时构建失败(仅在构建服务器上)。它试图复制 (A) 中的文件,就像它在 (B) 中一样。

构建dbproj(A)时,输出如下,没问题:

_CopyOutOfDateSourceItemsToOutputDirectory:
  Creating directory "D:\Builds\5\17\Binaries\Scripts".
  Copying file from "Scripts\FortressMainUpdate.sql" to "D:\Builds\5\17\Binaries\Scripts\FortressMainUpdate.sql".
  Copying file from "D:\Builds\5\17\Sources\Src\DataBase\MainDatabase\Scripts\FortressMainUpdate.sql" to "D:\Builds\5\17\Binaries\Scripts\FortressMainUpdate.sql".

然后在构建 dbproj (B) 时,服务器输出以下错误:
_CopyOutOfDateSourceItemsToOutputDirectory:
Building target "_CopyOutOfDateSourceItemsToOutputDirectory" partially, because some output files are out of date with respect to their input files.
  Copying file from "Scripts\FortressOqtUpdate.sql" to "D:\Builds\5\17\Binaries\Scripts\FortressOqtUpdate.sql".
  Copying file from "D:\Builds\5\17\Sources\Src\DataBase\OpenQueryTool\Scripts\FortressMainUpdate.sql" to "D:\Builds\5\17\Binaries\Scripts\FortressMainUpdate.sql".
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(3129,9): error MSB3021: Unable to copy file "D:\Builds\5\17\Sources\Src\DataBase\OpenQueryTool\Scripts\FortressMainUpdate.sql" to "D:\Builds\5\17\Binaries\Scripts\FortressMainUpdate.sql". Could not find file **'D:\Builds\5\17\Sources\Src\DataBase\OpenQueryTool\Scripts\FortressMainUpdate.sql'**. [D:\Builds\5\17\Sources\Src\DataBase\OpenQueryTool\CCO.Fortress.Database.OpenQueryTool.dbproj]
  Copying file from "D:\Builds\5\17\Sources\Src\DataBase\OpenQueryTool\Scripts\FortressOqtUpdate.sql" to "D:\Builds\5\17\Binaries\Scripts\FortressOqtUpdate.sql".

文件 D:\Builds\5\17\Sources\Src\DataBase\OpenQueryTool\Scripts\FortressMainUpdate.sql 是 dbproj (A) 中的那个,并且在 \DataBase\OpenQueryTool\Scripts\ 中从未存在过.

这仅发生在构建服务器上。在本地构建时,一切都很好。

我们的目标是将这些文件放在 tfs 放置位置,以及 dbproj 生成的 sql 文件,一旦构建了整个解决方案。

最佳答案

当前的解决方案是将文件复制到依赖项目文件夹中。

就我而言,我在主项目的 PreBuild 事件中执行此操作 - 了解两个项目之间的文件夹层次结构依赖关系。

关于tfs - 在我的 dbproj 中,在文件上设置 «Copy always» 或 «Copy if newer» 会使构建服务器上的构建失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8405305/

相关文章:

tfs - 搁置集如何存储在 TfsVersionControl 数据库中?

javascript - 如何安全地邀请自由职业者加入您的网络项目?

tfsbuild - 尽管选择了发布,TFS Build 仍在构建多个配置

tfs - 当 VS-team-services 工作项状态更改时配置 CI 构建和发布

visual-studio - TFS 构建通知未显示任何项目

c# - 检查文件是否已在源代码管理中

c# - FxCop 不尊重我的排除

c# - .cs 文件、项目和解决方案

c# - .NET Core ALINK : warning AL1073: Referenced assembly 'mscorlib.dll' targets a different processor

visual-studio - 在Visual Studio的TFS生成窗口中停止刷新