LordRazon
LordRazon

Reputation: 91

How to check TFS2013 Collection for Builds

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.

Upvotes: 0

Views: 105

Answers (2)

PatrickLu-MSFT
PatrickLu-MSFT

Reputation: 51083

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

Upvotes: 0

Eddie Chen - MSFT
Eddie Chen - MSFT

Reputation: 29968

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 "*****************************";
}

Upvotes: 0

Related Questions