[warning] xunit files are not located under the root directory

The following Warning appears in code analysis, and test and coverage results are not output.
Do I need to specify any parameters?

WARNING: File 'C:\Users\VssAdministrator\.nuget\packages\xunit.runner.visualstudio\2.4.0\build\netcoreapp1.0\xunit.runner.visualstudio.dotnetcore.testadapter.dll' is not located under the root directory 'D:\a\1\s' and will not be analyzed.
WARNING: File 'C:\Users\VssAdministrator\.nuget\packages\xunit.runner.visualstudio\2.4.0\build\netcoreapp1.0\xunit.runner.reporters.netcoreapp10.dll' is not located under the root directory 'D:\a\1\s' and will not be analyzed.
WARNING: File 'C:\Users\VssAdministrator\.nuget\packages\xunit.runner.visualstudio\2.4.0\build\netcoreapp1.0\xunit.runner.utility.netcoreapp10.dll' is not located under the root directory 'D:\a\1\s' and will not be analyzed.
WARNING: File 'C:\Users\VssAdministrator\.nuget\packages\microsoft.net.test.sdk\16.1.1\build\netcoreapp1.0\Microsoft.NET.Test.Sdk.Program.cs' is not located under the root directory 'D:\a\1\s' and will not be analyzed.
WARNING: File 'C:\Users\VssAdministrator\.nuget\packages\nunit3testadapter\3.13.0\build\netcoreapp1.0\NUnit3.TestAdapter.dll' is not located under the root directory 'D:\a\1\s' and will not be analyzed.
WARNING: File 'C:\Users\VssAdministrator\.nuget\packages\nunit3testadapter\3.13.0\build\netcoreapp1.0\NUnit3.TestAdapter.pdb' is not located under the root directory 'D:\a\1\s' and will not be analyzed.
WARNING: File 'C:\Users\VssAdministrator\.nuget\packages\nunit3testadapter\3.13.0\build\netcoreapp1.0\nunit.engine.netstandard.dll' is not located under the root directory 'D:\a\1\s' and will not be analyzed.
WARNING: File 'C:\Users\VssAdministrator\.nuget\packages\selenium.webdriver.chromedriver\74.0.3729.6\driver\win32\chromedriver.exe' is not located under the root directory 'D:\a\1\s' and will not be analyzed.

yml file:

pool:
  vmImage: 'vs2017-win2016'

variables:
  buildConfiguration: 'Release'

steps:
- task: SonarCloudPrepare@1
  inputs:
    SonarCloud: 'sonarcloud'
    organization: 'xxxxxxx'
    scannerMode: 'MSBuild'
    projectKey: 'xxx'
    projectName: 'xxx'

- task: Npm@1
  displayName: Install NPM modules.
  inputs:
    command: install
    workingDir: src/xx/xx

- task: DotNetCoreCLI@2
  displayName: Run tests.
  inputs:
    command: test
    projects: 'src/**/*Tests.csproj'
    arguments: '--configuration $(buildConfiguration)  /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:CoverletOutput=./TestResults/Coverage/ /p:Exclude="[xunit*]*%2c[*Test]*"'

- task: DotNetCoreCLI@2
  displayName: Publish xxx
  inputs:
    command: publish
    publishWebProjects: true
    arguments: '--configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)'
    projects: '**/xxx.csproj'

- task: DotNetCoreCLI@2
  displayName: Publish xxx
  inputs:
    command: publish
    publishWebProjects: false
    arguments: '--configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)'
    projects: '**/yyy.csproj'

- task: DotNetCoreCLI@2
  displayName: Publish IntegrationTests
  inputs:
    command: publish
    publishWebProjects: false
    zipAfterPublish: false
    arguments: '--configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)'
    projects: '**/IntegrationTests.csproj'

- task: PublishBuildArtifacts@1
  inputs:
   ArtifactName: drop

- task: SonarCloudAnalyze@1
  displayName: 'Run Code Analysis'

- task: SonarCloudPublish@1
  inputs:
    pollingTimeoutSec: '300'

Thank you !!!

Hi @00000012 - welcome to the community!

The warnings won’t affect whether the test and coverage results are uploaded or not: because of the way the test adapters are referenced in the MSBuild project file, they get passed through to the scanner as potential files to be analysed. The warnings are just to call out that they won`t be analysed.

Check the console output for the Run Code Analysis step (you can increase the verbosity of the output by setting the Azure DevOps pipeline variable system.debug=true). The output will specify where the task is looking for report and coverage files, and whether it has found any.

You may need to tell the scanner where to look using the parameters listed here.

1 Like