Microsoft.NET.Test.Sdk.Program.cs' is not located under the root directory

Must-share information (formatted with Markdown):

  • 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 presented:
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…

Hello @alexis19apl - welcome to the community.

The answer given by @orhtej2 to your identical StackOveflow post is correct. It’s a warning and doesn’t impact the analysis.

To give more context, the Scanner analyses files under a given root directory, which is normally the solution/project directory. It warns that it cannot analyse files that are outside that directory, which is what is happening here.

The reason those files are considered to part of the project is because the Microsoft.TestPlatform.TestHost NuGet package contains an MSBuild props file that adds them to the project as Content.