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