In my dbproj, the option "Always copy" or "Copy if new" in the file will fail on the build server

In VisualStudio 2010, we have a script in which one dbproj (B) refers to another dbproj (A).

In dbproj (A), if I install the build action on one of our custom sql scripts in the Scripts folder to either "Always copy" or "Copy if new", the build fails (only on the build server) when building dbproj (B). He tries to copy the file to (A), as if it were in (B).

When building dbproj (A), the output is as follows:

_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, when creating dbproj (B), the server displays 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 only happens on the build server. When building on site, everything is fine.

Our goal is to have these files in the tfs removal location with the dbproj sql file created after creating the whole solution.

+4
source share
1 answer

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

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

0
source

Source: https://habr.com/ru/post/1384982/


All Articles