[SOLVED] ERROR: Unable to TFS annotate the following file which is not in a mapped TFS workspace

Description
Hi, I am trying to do a complete Sonar Analysis on one of my client projects which is based on .Net C#. We are using Sonar scanner for MSBuild through VSTS builds. While running the analysis we are continuously getting the error ERROR: Unable to TFS annotate the following file which is not in a mapped TFS workspace.

Previously we also used to get this error : ERROR: Unable to TFS annotate the project which raised the following authentication exception: TF30063: You are not authorized to access https://{instance}.visualstudio.com/DefaultCollection but now it has converted to the above error.

Expected behavior
Sonar analysis should complete without the mentioned error.

Known workarounds
I tried the following stackoverflow https://stackoverflow.com/questions/45688981/tfs-annotation-error but this doesn’t seem to solve the issue.

Related information
SonarScanner for MSBuild 4.3.1
SonarQube version 6.7.4 (build 38452)
Usage:VSTS

Hi,

Do you get this error for every file or only for select files?

And BTW, an Administrator should be able to enter SCM credentials via the SonarQube UI.

Ann

This error comes for some of the files, not for all files

Hmm… You seem to be running into this:

And also code coverage is missing for those files. Some help would be really appreciated!!! What is the alternative for tfvc as it is not working?

Thanks @G Ann Campbell for your concern

The issue got resolved after applying the sonar scm property to tfvc.

Hi Subh,
I am facing the same issue. How and who can apply the sonar scm property to tfvc?

thanks