Search code examples
c#azure-devopssonarqube

SonarQube Run Code Analysis Azure DevOps task fails due not able to locate xunit.runner.visualstudio.dotnetcore.testadapter.dll


which versions are you using? (SonarQube, Scanner, Plugin, and any relevant extension)

Task version 4 - Azure DevOps Services

what are you trying to achieve?

Run Code Analysis

what have you tried so far to achieve this?

  1. Stop and Start the agent services
  2. Delete the folder _work and trigger a new run
  3. Install a new agent
  4. Run the agent with the local account
  5. Use a different version of dotnet task
  6. Add and Sleep task for 20 sec to avoid other resources using the same file
  7. Using the SonarQube Run Code Analysis Pluging instead the CMD call execution
  8. Using the SonarQube Run Code Analysis Pluging instead the CMD call execution in ver *5
  9. Fixed JAVA_HOME and JRE_HOME
  10. Updating VS2019

*Error Log:

17:56:22.652 17:56:22.652 WARNING: File ‘C:\windows\system32\config\systemprofile.nuget\packages\microsoft.net.test.sdk\16.6.1\build\netcoreapp2.1\Microsoft.NET.Test.Sdk.Program.cs’ is not located under the root directory ‘F:\AzureServicesAgents\AgentU07_work\1\s’ and will not be analyzed. 17:56:22.652 17:56:22.652 WARNING: File ‘C:\windows\system32\config\systemprofile.nuget\packages\microsoft.testplatform.testhost\16.6.1\build\netcoreapp2.1\x64\testhost.exe’ is not located under the root directory ‘F:\AzureServicesAgents\AgentU07_work\1\s’ and will not be analyzed. 17:56:22.653 17:56:22.653 WARNING: File ‘C:\windows\system32\config\systemprofile.nuget\packages\microsoft.testplatform.testhost\16.6.1\build\netcoreapp2.1\x64\testhost.dll’ is not located under the root directory ‘F:\AzureServicesAgents\AgentU07_work\1\s’ and will not be analyzed. 17:56:22.653 17:56:22.653 WARNING: File

I have check and this file is present on above path ‘C:\windows\system32\config\systemprofile.nuget\packages\xunit.runner.visualstudio\2.4.1\build\netcoreapp1.0\xunit.runner.visualstudio.dotnetcore.testadapter.dll’ is not located under the root directory

I have check and this file is present on above path ‘F:\AzureServicesAgents\AgentU07_work\1\s’ and will not be analyzed. 17:56:22.653 17:56:22.653 WARNING: File ‘C:\windows\system32\config\systemprofile.nuget\packages\xunit.runner.visualstudio\2.4.1\build\netcoreapp1.0\xunit.runner.reporters.netcoreapp10.dll’ is not located under the root directory ‘F:\AzureServicesAgents\AgentU07_work\1\s’ and will not be analyzed. 17:56:22.653 17:56:22.653 WARNING: File ‘C:\windows\system32\config\systemprofile.nuget\packages\xunit.runner.visualstudio\2.4.1\build\netcoreapp1.0\xunit.runner.utility.netcoreapp10.dll’ is not located under the root directory ‘F:\AzureServicesAgents\AgentU07_work\1\s’ and will not be analyzed. Calling the TFS Processor executable…


Solution

  • After reading several dependencies logs, did find out that in reality those files were analyze, it seems that "Azure DevOps" and "SonarQube" can't agree on what did happen after this pipeline execution so the take out is:

    • Depending on how it was implemented your SonarQube read the logs regarding the execution you are having issues with.
    • Compare those logs against the one from the VSTS_agent log associate with the specific task that throws the error and check the time stamp to ensure if there was an actual error or the execution passed clean

    Two other engineers with me agreed this is an error of data interpretation across the pipeline but, the logs prove that they passed, and the report was created in the SonarQube endpoint, so it would be ignored