public static BuildDefinitionDtoCollection GetBuildDefinitions(this TfsConfigurationServer tfsConfigurationServer, Guid teamProjectCollectionId, string teamProjectName) { if (tfsConfigurationServer == null) { throw new ArgumentNullException("tfsConfigurationServer"); } TfsTeamProjectCollection tfsTeamProjectCollection = tfsConfigurationServer.GetTeamProjectCollection(teamProjectCollectionId); IBuildServer buildServer = tfsTeamProjectCollection.GetService <IBuildServer>(); IBuildDefinition[] buildDefinitions = buildServer.QueryBuildDefinitions(teamProjectName); BuildDefinitionDtoCollection buildDefinitionDtoCollection = new BuildDefinitionDtoCollection(); foreach (IBuildDefinition buildDefinition in buildDefinitions) { BuildDefinitionDto buildDefinitionDto = new BuildDefinitionDto(); buildDefinitionDto.TeamProjectName = buildDefinition.TeamProject; buildDefinitionDto.Name = buildDefinition.Name; buildDefinitionDto.Id = buildDefinition.Id; buildDefinitionDto.Uri = buildDefinition.Uri; buildDefinitionDtoCollection.Add(buildDefinitionDto); } return(buildDefinitionDtoCollection); }
public ActionResult TeamBuildDefinitions(Guid teamProjectCollectionId, string teamProjectName) { BuildDefinitionDtoCollection buildDefinitionDtoCollection = GetTfsConfigurationServer().GetBuildDefinitions(teamProjectCollectionId, teamProjectName); this.ViewData[ViewDataKey.TeamProjectCollectionId] = teamProjectCollectionId; this.ViewData[ViewDataKey.TeamProjectName] = teamProjectName; return(this.View(buildDefinitionDtoCollection)); }
public static BuildDefinitionDtoCollection ListTeamBuilds(Uri tfsUrl) { TfsConfigurationServer tfsConfigurationServer = TfsConfigurationServerFactory.GetConfigurationServer(tfsUrl); TeamProjectDtoCollection teamProjectCollections = tfsConfigurationServer.GetAllTeamProjectsInAllTeamProjectCollections(); BuildDefinitionDtoCollection all = new BuildDefinitionDtoCollection(); foreach (TeamProjectDto teamProjectCollection in teamProjectCollections) { BuildDefinitionDtoCollection buildDefinitionDtoCollection = tfsConfigurationServer.GetBuildDefinitions(teamProjectCollection.CollectionId, teamProjectCollection.DisplayName); foreach (BuildDefinitionDto buildDefinitionDto in buildDefinitionDtoCollection) { all.Add(buildDefinitionDto); } } return all; }
public static BuildDefinitionDtoCollection ListTeamBuilds(Uri tfsUrl) { TfsConfigurationServer tfsConfigurationServer = TfsConfigurationServerFactory.GetConfigurationServer(tfsUrl); TeamProjectDtoCollection teamProjectCollections = tfsConfigurationServer.GetAllTeamProjectsInAllTeamProjectCollections(); BuildDefinitionDtoCollection all = new BuildDefinitionDtoCollection(); foreach (TeamProjectDto teamProjectCollection in teamProjectCollections) { BuildDefinitionDtoCollection buildDefinitionDtoCollection = tfsConfigurationServer.GetBuildDefinitions(teamProjectCollection.CollectionId, teamProjectCollection.DisplayName); foreach (BuildDefinitionDto buildDefinitionDto in buildDefinitionDtoCollection) { all.Add(buildDefinitionDto); } } return(all); }
private static void ListAllTeamBuilds(Uri tfsUrl) { System.Console.WriteLine("Listing all Team Builds for all Team Projects."); BuildDefinitionDtoCollection buildDefinitionDtoCollection = BuildServerFacade.ListTeamBuilds(tfsUrl); string currentTeamProject = null; foreach (BuildDefinitionDto buildDefinitionDto in buildDefinitionDtoCollection) { if (buildDefinitionDto.TeamProjectName != currentTeamProject) { System.Console.WriteLine(); System.Console.WriteLine("Team Project: '{0}'.", buildDefinitionDto.TeamProjectName); } System.Console.WriteLine("Team Build: '{0}'.", buildDefinitionDto.Name); currentTeamProject = buildDefinitionDto.TeamProjectName; } System.Console.WriteLine(); System.Console.WriteLine("Done."); }
public static BuildDefinitionDtoCollection GetBuildDefinitions(this TfsConfigurationServer tfsConfigurationServer, Guid teamProjectCollectionId, string teamProjectName) { if (tfsConfigurationServer == null) { throw new ArgumentNullException("tfsConfigurationServer"); } TfsTeamProjectCollection tfsTeamProjectCollection = tfsConfigurationServer.GetTeamProjectCollection(teamProjectCollectionId); IBuildServer buildServer = tfsTeamProjectCollection.GetService<IBuildServer>(); IBuildDefinition[] buildDefinitions = buildServer.QueryBuildDefinitions(teamProjectName); BuildDefinitionDtoCollection buildDefinitionDtoCollection = new BuildDefinitionDtoCollection(); foreach (IBuildDefinition buildDefinition in buildDefinitions) { BuildDefinitionDto buildDefinitionDto = new BuildDefinitionDto(); buildDefinitionDto.TeamProjectName = buildDefinition.TeamProject; buildDefinitionDto.Name = buildDefinition.Name; buildDefinitionDto.Id = buildDefinition.Id; buildDefinitionDto.Uri = buildDefinition.Uri; buildDefinitionDtoCollection.Add(buildDefinitionDto); } return buildDefinitionDtoCollection; }