0

Looking for a way to find how projects in a collection have builds instead of having to check project by project to find out.

Something simple with the name of the project that have a build on it.

LordRazon
  • 91
  • 7
  • What's the "name" of the Project? The name of the cs/vbproj or sln file you have the build definition building? – DaveShaw Nov 10 '16 at 23:25

2 Answers2

0

No, you can't there is no simple way to achieve this. The build definition is created on the Team Explorer - Build- New Build Definition. It's project level, not team project collection level. Source Link: Create or edit a build definition


Update

If you want to get the similar result of builds in Team Explore, you may have to use TFS API to achieve this, by using IBuildServer.QueryBuilds.

You have to konw the project name first then you can query builds based on a date filter. You don’t need the associated work items for the builds, nor the associated changesets or a bunch of other stuff. This increased performance ,sample code as below:

var buildSpec = buildServer.CreateBuildDetailSpec(teamProjectName, buildDefinition);
buildSpec.InformationTypes = null;
buildSpec.MinFinishTime = DateTime.Now.AddHours(-lastXHours);
var buildDetails = buildServer.QueryBuilds(buildSpec).Builds;

More details please refer this blog: Fastest way to get list of builds using IBuildServer.QueryBuilds and this one TFS API - How to query builds independent of which build definition they belong to

Community
  • 1
  • 1
PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62
  • I have full admin rights to the TFS on all ends. So I can go into each project, but I have 2 collections with over 100 projects. So having to check each one with Team Explore for it becomes really tedious. Only thing I don't have access to is the Build Controllers or know how many are other since that's managed by the teams that need it. – LordRazon Nov 11 '16 at 14:42
  • Did you want to get the build definition or just the builds? If you want to get the similar result of builds in Team Explore, you may have to use TFS API to achieve this, by using `IBuildServer.QueryBuilds`. Details see this blog: [Fastest way to get list of builds using IBuildServer.QueryBuilds](http://incyclesoftware.com/2012/09/fastest-way-to-get-list-of-builds-using-ibuildserver-querybuilds-2/) – PatrickLu-MSFT Nov 14 '16 at 06:38
0

If the projects you mentioned are TeamProject, you can create a simple powershell script to get this via TFS API:

$collectionurl = "http://xxxxxxxx/";
$tfs = [Microsoft.TeamFoundation.Client.TfsTeamProjectCollectionFactory]::GetTeamProjectCollection($collectionurl);
$buildservice = $tfs.GetService([Microsoft.TeamFoundation.Build.Client.IBuildServer]);
$workitemservice = $tfs.GetService([Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore]);
$projects = $workitemservice.Projects;
foreach ($project in $projects)
{
    $builds = $buildservice.QueryBuilds($project.Name);
    Write-Host $project.Name;
    Write-Host "Build Count:"  $builds.Count;
    Write-Host "*****************************";
}
Eddie Chen - MSFT
  • 29,708
  • 2
  • 46
  • 60