TFS Build:如何配置Post Build事件

时间:2016-08-26 15:01:05

标签: tfsbuild tfs2013

我是这个TFS BUILD的新手,目前我有没有源代码的供应商应用程序我只有已发布的文件,如(Bin,图像,aspx文件和DLL)已发布的文件我需要复制供应商提供给我的所有文件并粘贴到目标位置。

Below is the configuration i done in TFS build definition.
1. Source setting tab
    a) Source Control folder - Project Location
    b) build agent folder - $(SourceDir)
2. Build defaults
    a) Build controller - as defined my client.
    b) staging location - my dev server path(\\devserver\foldername)
3. Process tab
    a) Process parameter
        i) required 
           - Items to build
               * project to build - what should i give here whether the solution         file or bat file manually created by me.
        2) post build script - i mapped my bat file.

Bat file commands.

 cd /d %2
 md "VEMS_PROD_Sample"
 cd webdeploy
 xcopy *.* %2\VEMS_PROD_26082016_V1 /E

如果我运行上面的设置文件没有复制下面是我得到的日志

2016-08-26 10:27:59,796 INFO 

C:\Windows\system32>cd /d "D:\8228\Binaries" 

D:\8228\Binaries>md "VEMS_PROD_Sample" 

D:\8228\Binaries>cd webdeploy 

D:\8228\Binaries>xcopy *.* "D:\8228\Binaries"\VEMS_PROD_26082016_V1 /E 
0 File(s) copied
 ==================================================
 2016-08-26 10:27:59,834 ERROR 
 The system cannot find the path specified.
Cannot perform a cyclic copy

1 个答案:

答案 0 :(得分:0)

通常在递归源目标位置重叠时出现错误。

根据日志信息,命令cd webdeploy失败,当您运行xcopy命令时,它仍在D:\8228\Binaries>下。请仔细检查代理上是否有webdeploy文件夹,或者您是否有足够的权限进入该文件夹。

此外,建议您在xcopy命令中添加/y,如下所示:

xcopy /E /Y "$(ProjectDir)Views" "$(SolutionDir)MEFMVCPOC\Views"

/Y - Do not prompt for overwrite of existing files. 

有关post build中xcopy命令的更多详细信息,请参阅: