如何使用天蓝色管道在TFS中签入文件 [英] How can I check-in files in TFS with azure pipelines

查看:71
本文介绍了如何使用天蓝色管道在TFS中签入文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试自动化构建javascript捆绑软件的本地部署脚本,然后在TFS命令行工具的帮助下,将捆绑软件签入TFS存储库中.

I'm trying to automate a local deployment script that builds a javascript bundle and then, with the help of TFS command line tool, it checks-in the bundle into a TFS repository.

现在,我具有构建捆绑包的管道,但是我仍然需要最后一个Task,它将创建的文件放入TFS.重要的是要注意,TFS在另一个项目中.

Right now I have the pipeline building the bundle but I still need a last Task that puts the created files into TFS. It is important to note that the TFS is in another project.

是否有Taks可以签入TFS?如果没有,在没有使用自定义脚本的情况下该怎么办?

Is there a Taks that does check-ins to TFS? If not, what alternatives do I have without using a custom script for that?

推荐答案

我写了一些PowerShell脚本来从我的版本中进行检入:

I wrote a little PowerShell script to do check-in from my build:

$newCodeFolderPath = "$($env:Agent_BuildDirectory)\newCode"
$tempWorkspacePath =  "$($env:Agent_BuildDirectory)\tempWorkspace"

New-Item -Path $newCodeFolderPath -ItemType directory

Copy-Item -Path "/your/fules/you/want/checkin" -Recurse -Destination $newCodeFolderPath 

New-Item -Path $tempWorkspacePath -ItemType directory

cd $tempWorkspacePath 

#For VS 2017 (in other versions the tf.exe location is different)
$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 "{TFS proeject path (where you want to check in)}" $tempWorkspacePath 

Copy-Item -Path "$($newCodeFolderPath)/*" -Recurse -Destination $tempWorkspacePath 

& $tfExe add * /recursive /noignore

& $tfExe checkin /recursive /comment:"from build"

& $tfExe workspace /delete /collection:{TfsCollection} "Tempworkspace"

cd c:/
Remove-Item -Path $newCodeFolderPath -Force -Recurse
Remove-Item -Path $tempWorkspacePath -Force -Recurse

这篇关于如何使用天蓝色管道在TFS中签入文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆