4

In VisualStudio 2010, we have a scenario where one dbproj (B) reference another dbproj (A).

In dbproj (A), if I set the build action on one of our custom sql script in the Scripts folder to «Copy always» or «Copy if newer» the build fail (on build server only) while building dbproj (B). It tries to copy the file in (A) as if it was in (B).

While building dbproj (A), the output is as follows, which is ok:

_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".

And then while building dbproj (B), the server output the following errors:

_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".

The file D:\Builds\5\17\Sources\Src\DataBase\OpenQueryTool\Scripts\FortressMainUpdate.sql is the one that is in dbproj (A), and never existed in \DataBase\OpenQueryTool\Scripts\.

This happens only on the build server. When building locally, everything is fine.

Our goal is to have those files in the tfs drop location, with the dbproj generated sql file, once the whole solution is built.

jessehouwing
  • 106,458
  • 22
  • 256
  • 341
  • If you are using MSBuild on build server and VS2010 locally, try to build it locally using MSBuild. – Ludwo Dec 07 '11 at 08:54
  • @Ludwo Same result. What I don't understand, is why the dependence between both project, make the build tries to copy the file from the _wrong_ (from my point of view) place. – Hugues Ferland Dec 07 '11 at 15:26
  • @Ludwo To fix my issue, I manually copied the file to the directory the build think the file should be and now, the build copy the file from both places (at least using MSBuild locally). So, as of now, I got my solution. Thanks. – Hugues Ferland Dec 07 '11 at 16:09

1 Answers1

0

The current solution is to copy the file to the dependent project folder.

In my case, I do that in the PreBuild event of the main project - knowing the folders hierarchical dependency between both projects.