diff --git a/scripts/dotnet-cli-build/PublishTargets.cs b/scripts/dotnet-cli-build/PublishTargets.cs index f9903ed46..5d3f74bc4 100644 --- a/scripts/dotnet-cli-build/PublishTargets.cs +++ b/scripts/dotnet-cli-build/PublishTargets.cs @@ -69,13 +69,16 @@ namespace Microsoft.DotNet.Cli.Build // at the same time and someone already took care of publishing and we have no work to do. if (AzurePublisherTool.IsLatestSpecifiedVersion(targetVersionFile)) { - AzurePublisherTool.ReleaseLeaseOnBlob(targetContainer, leaseId); + AzurePublisherTool.ReleaseLeaseOnBlob(semaphoreBlob, leaseId); return c.Success(); } else { // This is an old drop of latest so remove all old files to ensure a clean state - AzurePublisherTool.ListBlobs($"{targetContainer}").ToList().ForEach(f => AzurePublisherTool.TryDeleteBlob(f)); + AzurePublisherTool.ListBlobs($"{targetContainer}") + .Select(s => s.Replace("/dotnet/", "")) + .ToList() + .ForEach(f => AzurePublisherTool.TryDeleteBlob(f)); // Drop the version file signaling such for any race-condition builds (see above comment). AzurePublisherTool.DropLatestSpecifiedVersion(targetVersionFile);