简体   繁体   English

如何在 Visual Studio 中获取已连接的 TFS 项目的列表?

[英]How do I get a list of connected TFS projects in Visual Studio?

Using the Visual Studio 2010 and TFS 2010 SDK, I want to get the list of projects in the current collection that the user has selected.使用 Visual Studio 2010 和 TFS 2010 SDK,我想获取用户选择的当前集合中的项目列表。

How do I do this?我该怎么做呢?

I can get the collection uri with this code, but not the projects:我可以使用此代码获取集合 uri,但不能获取项目:

TeamFoundationServerExt tfsExt =
               (TeamFoundationServerExt)Dte.GetObject("Microsoft.VisualStudio.TeamFoundation.TeamFoundationServerExt");

if (tfsExt == null) return;

var activeTfsUri = tfsExt.ActiveProjectContext.DomainUri;

Try this:尝试这个:

    TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(tpcURI);
    ICommonStructureService css = tpc.GetService<ICommonStructureService>();
    ProjectInfo[] projects = css.ListProjects();

It should give you the name, uri and the status of the projects.它应该为您提供项目的名称、uri 和状态。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在活动的Visual Studio配置中构建项目? - How do I get the projects to build in the active Visual Studio configuration? 如何获取当前Visual Studio解决方案中的项目列表? - How to get list of projects in current Visual studio solution? 除非将Visual Studio连接到TFS项目,否则以编程方式连接到TFS会引发未授权错误。 我怎样才能解决这个问题? - Connecting to TFS programatically throws Unauthorized error, unless visual studio is connected to TFS Project. How can i fix this? TFS API-如何仅返回经过身份验证的用户有权访问的项目,而不是整个列表? - TFS API - how do I return only projects that an authenticated user has permissions to, instead of the whole list? 如何获取TFS 2013中所有用户的列表 - How do I get list of all users in TFS 2013 如何与TFS连接并获取特定用户的项目列表 - How to connect with TFS and get list of projects for a specific user 如何在Visual Studio和TFS中使用共享核心处理客户特定的代码 - How do I handle customer specific code with a shared core in Visual Studio and TFS 我可以在Visual Studio解决方案中列出所有*不可用*项目吗? - Can I list all *unavailable* projects in a Visual studio solution? 通过FTP连接时如何停止Visual Studio 2010下载大文件 - How do I stop Visual Studio 2010 from downloading large files when connected through FTP 如何在 Visual Studio 2022 中使用已连接的 SQL 服务器数据库进行查询? - How do I make a query using my connected SQL Server Database in Visual Studio 2022?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM