Using the API, you can get the drop location from the build. The code below gets the most recent build for a given project, and returns the dropfolder.
public string DropFolder(TeamFoundationServer tfs, string teamProject, string buildName)
{
IBuildServer buildServer = (IBuildServer)tfs.GetService(typeof(IBuildServer));
IBuildDetailSpec buildDetailSpec = buildServer.CreateBuildDetailSpec(teamProject, buildName);
buildDetailSpec.MaxBuildsPerDefinition = 1;
buildDetailSpec.QueryOrder = BuildQueryOrder.FinishTimeDescending;
buildDetailSpec.Status = BuildStatus.Failed | BuildStatus.PartiallySucceeded | BuildStatus.Stopped | BuildStatus.Succeeded;
IBuildQueryResult results = buildServer.QueryBuilds(buildDetailSpec);
if (results.Failures.Length != 0)
{
throw new ApplicationException("this needs to go away and be handled more nicely");
}
if (results.Builds.Length == 1)
{
results.Builds[0].DropLocation;
}
else
{
return null;
}
}