public async Task DeleteDefinitions() { var defs = await _buildClient.GetDefinitionsAsync(project : vsts_projectName); foreach (var d in defs) { await _buildClient.DeleteDefinitionAsync(new Guid(vsts_projectId), d.Id); } }
/// <summary> /// remove build definition - by name - if it exists /// </summary> /// <param name="buildClient">extension method link</param> /// <param name="targetProjectId">id of the target project to look the definition in</param> /// <param name="definitionName">name of the definition to remove</param> /// <returns></returns> public static async Task DeleteDefinitionIfExists(this BuildHttpClient buildClient, string targetProjectId, string definitionName) { BuildDefinitionReference definition; if ((definition = (await buildClient.GetDefinitionsAsync(targetProjectId, name: definitionName)).FirstOrDefault()) != null) { await buildClient.DeleteDefinitionAsync(targetProjectId, definition.Id); } }
public void DeleteBuildDefinitinIfPossible() { var definitions = buildClient.GetDefinitionsAsync(project: SelectedProject.Name).Result; DummyBuildDef = definitions.FirstOrDefault(b => b.Name == DummyDefName); if (DummyBuildDef != null) // clone needs to be deleted { var cloneResult = buildClient.DeleteDefinitionAsync(SelectedProject.Id, DummyBuildDef.Id); } }
public static Task DeleteDefinitionAsync(this BuildHttpClient source, BuildDefinition definition, CancellationToken cancellationToken) => source.DeleteDefinitionAsync(definition.Project.Id, definition.Id, cancellationToken: cancellationToken);