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
ganncamp
(G Ann Campbell)
July 5, 2018, 6:22pm
2
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
ganncamp
(G Ann Campbell)
July 6, 2018, 1:00pm
4
Hmm… You seem to be running into this:
opened 05:28AM - 01 Aug 17 UTC
closed 06:26PM - 16 Jul 19 UTC
While SonarQube can correctly do annotation when I run the compile locally, it's… not working for TFS from us. It keeps erroring with "Unable to TFS annotate the following file which is not in a mapped TFS workspace" on all of the files.
I know there have been some attempts in the past to solve this issue (https://github.com/SonarQubeCommunity/sonar-scm-tfvc/pull/7, https://github.com/SonarQubeCommunity/sonar-scm-tfvc/pull/13); we have v2.6.2 of the TFVC plugin installed which has those fixes. Apparently clearing the cache isn't doing it for us.
When I try checking Workstation.Current.IsMapped(path) myself post-build, it's returning true. So I have no idea why it's not doing so when SonarTfsAnnotate.exe is run during the build.
We're running TFS2012, and still using old-school TFSBuild.proj-based builds, with our .targets file is invoking SonarQube.Scanner.MSBuild.exe begin/end at the appropriate times. (The TFS2013 object model is installed.)
I'm out of ideas as to what the issue could be. Any thoughts on what I could look at, or other information I could provide?
gelihu
(Elihu)
July 12, 2018, 8:17am
5
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.
rsaini3
(Rajesh Saini)
November 21, 2018, 10:05am
7
Hi Subh,
I am facing the same issue. How and who can apply the sonar scm property to tfvc?
thanks