6

It would be great if someone can help me to fix the randomly seeing error in VSTS Build agents:

MSBUILD : Logger error MSB4104: Failed to write to log file XYZ.sln.log. . The process cannot access the file XYZ.sln.log because it is being used by another process. ##[error]Process msbuild.exe exited with code 1.

Restarted the agent, configured windows machine...

Yan Sklyarenko
  • 31,557
  • 24
  • 104
  • 139

2 Answers2

4

MSBUILD : Logger error MSB4104: Failed to write to log file “XYZ.sln.log”

First, if the log file is not needed for you, on the Azure Devops, uncheck "Create Log File" in the "Advanced" section of each MSBuild task or Visual Studio task:

enter image description here

But, if you need that log file or the Create Log File checkbox is unchecked, check if the current user have the write permission to that log file folder.

If above not help to resolve this issue, please set system.debug as true in build definition and queue a new build, then provide complete build logs and the definition about the build task for us.

Hope this helps.

Leo Liu
  • 71,098
  • 10
  • 114
  • 135
  • I had the same problem, this "solved it". We have enough logging data with the Azure DevOps logs shown in the web GUI at every step, which also allow it's download if further processing/debugging were needed. – ElMesa May 16 '19 at 15:55
2

If you have "Create Log File" not selected already and you are still getting this issue, try below steps:

  • Edit your build definition
  • Click on Variables
  • Find for system.debug variable and set its value to false

For us it was system.debug = true causing this exceptions.

Admittedly I also came to know about it from below link

https://developercommunity.visualstudio.com/content/problem/561551/visual-studio-build-11510-the-process-cannot-acces.html

Rakesh Guranani
  • 523
  • 6
  • 15