开发者

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.

How do I do this?

I can get the collection uri with this code, but not the projects:

TeamFound开发者_开发问答ationServerExt 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜