[英]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.