[英]VSTS: Publish build artifacts to remote repository TFVC
是否可以将Visual Studio团队服务的构建管道(工件)的输出发布到存储库? 我们的仓库由VSTS托管,我们使用TFVC(团队基础版本控制来存储我们的代码)。
我已经使用了开箱即用的复制和发布任务,但是没有用。
非常感谢您的回应!
就像Daniel所说的那样, 这被认为是不好的作法 ,但是如果您仍然希望这样做,可以使用PowerShell脚本来实现:
Param(
[string]$tfvcRepoPath
)
$artifactsFolderPath = "$($env:Agent_BuildDirectory)\newCode"
$tempWorkspacePath = "$($env:Agent_BuildDirectory)\tempWorkspace"
New-Item -Path $artifactsFolderPath-ItemType directory
Copy-Item -Path "$($env:Build_ArtifactStagingDirectory)/*" -Recurse -Destination $artifactsFolderPath
New-Item -Path $tempWorkspacePath -ItemType directory
cd $tempWorkspacePath
$tfExe = "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\tf.exe"
& $tfExe workspace /collection:{TfsCollection} /new "TempWorkspace" /noprompt
& $tfExe workfold "$($tfvcRepoPath)" $tempWorkspacePath
Copy-Item -Path "$($artifactsFolderPath)/*" -Recurse -Destination $tempWorkspacePath
& $tfExe add * /recursive /noignore
& $tfExe checkin /recursive /comment:"artficats after build"
& $tfExe workspace /delete /collection:{TfsCollection} "Tempworkspace"
cd c:/
Remove-Item -Path $newCodeFolderPath -Force -Recurse
Remove-Item -Path $tempWorkspacePath -Force -Recurse
更改与您安装的Visual Studio版本有关的$tfExe = "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Professional\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer\\tf.exe"
(我使用了VS 2017专业版的路径)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.