从Team Foundation Server检索文件 [英] Retrieving file from Team Foundation Server

查看:61
本文介绍了从Team Foundation Server检索文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新手,正在编写VB.NET程序,但我不知道该怎么做:
a)将文件从TFS复制到硬盘驱动器
b)读取TFS中文件的内容

我尝试过的google搜索被证明不成功.

到目前为止,我正在使用VS2008 SDK中的以下.dll:

Microsoft.TeamFoundation.Client.dll
Microsoft.TeamFoundation.VersionControl.Client.dll
Microsoft.TeamFoundation.VersionControl.Common.dll

I''m new to development and am coding a VB.NET program and I cannot figure out how to either:
a) Copy file(s) from TFS to the hard drive
b) Read the contents of file(s) in TFS

The google searches I''ve attempted have proven unsuccessful.

Thus far I''m using the following .dll''s from the VS2008 SDK:

Microsoft.TeamFoundation.Client.dll
Microsoft.TeamFoundation.VersionControl.Client.dll
Microsoft.TeamFoundation.VersionControl.Common.dll

推荐答案

创建一个VersionControlServer实例.
然后调用GetItem方法获取要下载的文件的实例,然后调用其Download方法.

例如

Createa a VersionControlServer instance..

Then call the GetItem method to obtain the instance of the file you want to download, then call its Download method.

E.g.

TeamFoundationServer tfsServer = new TeamFoundationServer(tfsUri, credentials);
VersionControlServer vcServer = (VersionControlServer)tfsServer.GetService(typeof(VersionControlServer));
if (vcServer == null)
    throw new ApplicationException("Invalid vcServer");

Item i = vcServer.GetItem(@"


/Path/To/MyFile .File"); i.DownloadFile( @" );
/Path/To/MyFile.File"); i.DownloadFile(@"C:\MyFile.File");



我只是注意到您正在VB.Net中进行此操作,应该很容易从C#进行转换.



I just noticed you''re doing this in VB.Net, should be easy to convert from C#.


首先要澄清的是,如果您的项目已经连接(添加)到Team Foundation是否使用服务器.

如果是,则需要按照以下步骤操作

1.打开查看"菜单,然后选择团队资源管理器
2.然后通过单击连接到服务器"来连接到服务器.
3.然后选择项目
4.打开项目中的文件,然后右键单击任何文件,这将为您提供不同的选项来选择此文件.

i)获取最新版本
ii)获取特定版本选项


如果此答案不正确,请提供更多解释.
Here few clarification first, If your project is already connect (added) to Team foundation server or not.

If yes you need to follow these steps

1. Open the View menu and choose the team explorer
2. then connect to server, by clicking the "connect to server".
3. then choose the project
4. Open the files in the project and right click on any file, it will give you different option to choose this file.

i) Get Latest version
ii) get the Specific version options


If this answer is not correct, Give the explanation more.


这篇关于从Team Foundation Server检索文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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