You have to wait until the "Build Information Cleanup Job" runs (by default it runs every two days). This is the job which cleans up tbl_buildInformation after you run TFSBuild.exe delete
and TFSBuild.exe destroy
.
You can check its schedule with (in PowerShell):
$collection = "http://yourservername:8080/tfs/YourCollection" # change this to the URL of your team project collection
$pathToAss2 = "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\ReferenceAssemblies\v2.0"
$pathToAss4 = "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\ReferenceAssemblies\v4.5"
Add-Type -Path "$pathToAss2\Microsoft.TeamFoundation.Client.dll"
Add-Type -Path "$pathToAss2\Microsoft.TeamFoundation.Common.dll"
Add-Type -Path "$pathToAss2\Microsoft.TeamFoundation.WorkItemTracking.Client.dll"
Add-Type -Path "$pathToAss2\Microsoft.TeamFoundation.VersionControl.Client.dll"
Add-Type -Path "$pathToAss4\Microsoft.TeamFoundation.ProjectManagement.dll"
$tpc = [Microsoft.TeamFoundation.Client.TfsTeamProjectCollectionFactory]::GetTeamProjectCollection($collection)
$jobService = $tpc.GetService([Microsoft.TeamFoundation.Framework.Client.ITeamFoundationJobService])
$job = $jobService.QueryJobs() | Where-Object {$_.Name -eq "Build Information Cleanup Job"}
$job
$jobService.QueryLatestJobHistory([Guid[]] @($job.JobId))
To queue the job for running immediately, run the previous commands followed by the following command:
$jobService.QueueJobNow([Guid] $job.JobId, $false)
To change the schedule, run:
$interval = 172800 # change this to the number of seconds between each run; 172800 = 2 days
$job.Schedule[0].Interval = $interval # there is only one schedule for the build information clean-up job, we set its interval
$jobService.UpdateJob($job)
To actually see when the next run of this job is scheduled, you have to go to the DB and run the following query (the query is not completely correct because it shows in the columns "ScheduledTime" and "Interval" the information of Tfs_YourCollection for all listed collections, the other information is correct, especially the QueueTime):
USE Tfs_YourCollection
SELECT S.JobId, D.JobName, S.ScheduledTime, S.Interval, CQ.QueueTime, SH.Name
FROM tbl_JobSchedule S
LEFT OUTER JOIN tbl_JobDefinition D ON D.JobId = S.JobId
LEFT OUTER JOIN [Tfs_Configuration].dbo.tbl_JobQueue CQ ON CQ.JobId = S.JobId
LEFT OUTER JOIN [Tfs_Configuration].dbo.tbl_ServiceHost SH ON SH.HostId = CQ.JobSource
WHERE D.JobName = 'Build Information Cleanup Job'
See http://blogs.msdn.com/b/chrisid/archive/2010/02/15/introducing-the-tfs-background-job-agent-and-service.aspx and http://blogs.msdn.com/b/granth/archive/2013/02/13/tfs2012-what-are-all-the-different-jobs-built-in-to-tfs.aspx for more information.