We are getting exception “System.IO.PathTooLongException” in Run Code Analysis task. This step is working fine for couple of branches and throwing error in other branches. From the build server, we can see that maximum length of the file name is 254.

Below are the details. Please let me know for further details.

  • ALM : Azure DevOps

  • CI : Azure DevOps

  • Scanner Task : Run Code Analysis

  • Languages of the repository : .NET

  • Error observed : ##[error]System.IO.PathTooLongException: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.

  • Steps to reproduce :
    Prepare analysis on SonarCloud
    Use NuGet 4.4.1
    NuGet restore
    Build solution
    Test Assemblies
    Run Code Analysis

Thank You,



You are facing a Windows limitation here.

If you can’t reduce the number of depth in your repository’s folder structure, the only solution i can gave you is to switch your build agent to a Linux-hosted one.


1 Like