I am maintaining a build configuration in Teamcity. It works most of the time, but about 1/8 of the time it fails with cryptic error messages. The failures and successes happen even when there is no changes. Screenshot of build config page
Error message 1:
dotnet publish Starting: .NET SDK 5.0.300 "C:\Program Files\dotnet\dotnet.exe" publish D:\BuildAgent\work\576d3d312224491\UIAutomatedTest.sln --configuration Release @D:\BuildAgent\temp\agentTmp\1.rsp -r win10-x64 --self-contained true in directory: D:\BuildAgent\work\576d3d312224491 Failed to load the dll from [C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.6\coreclr.dll], HRESULT: 0x80070020 Process exited with code -1073740791 Process exited with code -1073740791
Error message 2:
Starting: .NET SDK 5.0.300 "C:\Program Files\dotnet\dotnet.exe" publish D:\BuildAgent\work\576d3d312224491\UIAutomatedTest.sln --configuration Release @D:\BuildAgent\temp\agentTmp\1.rsp -r win10-x64 --self-contained true in directory: D:\BuildAgent\work\576d3d312224491 Unhandled exception. System.IO.FileLoadException: Could not load file or assembly 'C:\Program Files\dotnet\sdk\5.0.300\dotnet.dll'. The process cannot access the file because it is being used by another process. (0x80070020) File name: 'C:\Program Files\dotnet\sdk\5.0.300\dotnet.dll' Process exited with code -532462766 Process exited with code -532462766
I suspected that the errors may have been caused by a previous build not releasing the dll's, but the build failures happen even when there is no queue to start the build. Has anyone encountered similar problems before? What could cause the builds to fail only intermittently?