0

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?

4
  • Before someone asks why I am running builds without new changes, the build pulls data from a REST Api that could be updated, but that isn't the issue here.
    – SemajPMI
    Commented Jul 23, 2021 at 13:58
  • What troubleshooting have you done? Does are both failing and successful builds run on the same build-node? Does it work if you run the command manually on the build-node?
    – JonasH
    Commented Jul 23, 2021 at 14:08
  • @JonasH Both fallures and successes are run on the same build agent. Its hard to troubleshoot since I can't replicate it on a local machine.
    – SemajPMI
    Commented Jul 23, 2021 at 14:10
  • You should be able to remote into the build-agent and see if the build works there, it might be useful to test both using visual studio and running the build commands from the command-line. Tools like process explorer might also be useful to see if any files are in use.
    – JonasH
    Commented Jul 23, 2021 at 14:18

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.