如何使用 c# API 移动 TFS 文件? [英] How do I move a TFS file with c# API?

查看:28
本文介绍了如何使用 c# API 移动 TFS 文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在谷歌上搜索如何使用 TFS API 使用 c# 移动文件.这个想法是有一个文件夹,开发人员可以在该文件夹上放置数据库升级脚本,并且构建过程到达该文件夹会创建一个构建脚本,并将文件夹中的所有文件移动到一个包含我们刚刚创建的数据库构建版本的新文件夹中.

I have been googling for a good time on how to move a file with c# using the TFS API. The idea is to have a folder on which the developers drop database upgrade scripts and the build process get's to the folder creates a build script and moves all the files on the folder to a new folder with the database build version that we just created.

我找不到任何关于在 TFS 中以编程方式移动文件的参考...(除了 cmd 命令行)

I cannot seriously find any reference about moving files programatically in TFS... (aside of the cmd command line)

有人知道通过 C# 学习 TFS 源控制文件操作的良好指南/msdn 起点吗?

does anybody know of a good guide / msdn starting point for learning TFS source control files manipulation via c#?

推荐答案

很简单 :).

Microsoft.TeamFoundation.VersionControl.Client.Workspace workspace = GetMyTfsWorkspace();
workspace.PendRename( oldPath, newPath );

那你当然需要CheckIn.使用workspace.GetPendingChanges()"和workspace.CheckIn()"方法来做到这一点.

Then you need CheckIn it of course. Use a "workspace.GetPendingChanges()" and "workspace.CheckIn()" methods to do it.

这篇关于如何使用 c# API 移动 TFS 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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