The publish task is failing with this error
Task : Publish Build Artifacts
Description : Publish build artifacts to Azure Pipelines/TFS or a file share
Version : 1.142.2
Author : Microsoft Corporation
Uploading 1 files
Total file: 1 ---- Processed file: 0 (0%)
Fail to upload 'E:Agent08_work2aUI.WebAPI.zip' due to 'The file exists'.
System.IO.IOException: The file exists
at System.IO.Path.GetTempFileName()
at Microsoft.VisualStudio.Services.FileContainer.Client.FileContainerHttpClient.UploadFileAsync(Int64 containerId, String itemPath, Stream fileStream, Guid scopeIdentifier, CancellationToken cancellationToken, Int32 chunkSize, Boolean uploadFirstChunk, Object userState, Boolean compressStream)
at Microsoft.VisualStudio.Services.Agent.Worker.Build.FileContainerServer.UploadAsync(IAsyncCommandContext context, Int32 uploaderId, CancellationToken token)
1 files failed to upload, retry these files after a minute.
Retry file upload after 60 seconds.
Retry file upload after 55 seconds.
Retry file upload after 50 seconds.
Retry file upload after 45 seconds.
Retry file upload after 40 seconds.
Retry file upload after 35 seconds.
Retry file upload after 30 seconds.
Retry file upload after 25 seconds.
Retry file upload after 20 seconds.
Retry file upload after 15 seconds.
Retry file upload after 10 seconds.
Retry file upload after 5 seconds.
Start retry 1 failed files upload.
Total file: 1 ---- Processed file: 0 (0%)
Fail to upload 'E:Agent08_work2aUI.WebAPI.zip' due to 'The file exists'.
System.IO.IOException: The file exists
at System.IO.Path.GetTempFileName()
at Microsoft.VisualStudio.Services.FileContainer.Client.FileContainerHttpClient.UploadFileAsync(Int64 containerId, String itemPath, Stream fileStream, Guid scopeIdentifier, CancellationToken cancellationToken, Int32 chunkSize, Boolean uploadFirstChunk, Object userState, Boolean compressStream)
at Microsoft.VisualStudio.Services.Agent.Worker.Build.FileContainerServer.UploadAsync(IAsyncCommandContext context, Int32 uploaderId, CancellationToken token)
@jmaragon, looks like your %TEMP% folder either may contain more than 65,535 files, or similarly, it has so many files that GetTempFileName() cannot generate a temporary file name.
https://docs.microsoft.com/en-us/dotnet/api/system.io.path.gettempfilename?view=netframework-4.8
My recommendation would be to clean your %TEMP% folder and see if that fixes the issue. Let us know if this ever happens in the future. 馃槃
@juliobbv , you are right, cleaning the %TEMP% folder has solved this issue (and collaterally, some others), but the tricky part was finding the right %TEMP% folder, which is _not the one provided by this environment variable for your logged on user, but the one you get looking at the Build Agent Capabilities_
which, in my case was something similar to this..

Most helpful comment
@jmaragon, looks like your
%TEMP%folder either may contain more than 65,535 files, or similarly, it has so many files thatGetTempFileName()cannot generate a temporary file name.https://docs.microsoft.com/en-us/dotnet/api/system.io.path.gettempfilename?view=netframework-4.8
My recommendation would be to clean your
%TEMP%folder and see if that fixes the issue. Let us know if this ever happens in the future. 馃槃