Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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...

like image 209
Narayan Lakkimsetti Avatar asked May 09 '19 11:05

Narayan Lakkimsetti


2 Answers

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.

like image 144
Leo Liu-MSFT Avatar answered Nov 11 '22 17:11

Leo Liu-MSFT


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

like image 33
Rakesh Guranani Avatar answered Nov 11 '22 16:11

Rakesh Guranani