ERROR: Invalid value of sonar.sources [TFS 2017]

818 views
Skip to first unread message

Majhoul Mahboul

unread,
Mar 15, 2018, 10:08:18 AM3/15/18
to SonarQube

Hi everyone,


I have a .NET project and I'm using Team Foundation Server 2017 Update 3.1. I installed the SonarQube extension from Visual Studio Marketplace.

So I configured the three tasks that the extension provides like this :

Prepare Analysis Configuration : 


Additional Properties : 

sonar.sources=.
sonar.language=cs
sonar.sourceEncoding=utf-8

So I placed the Prepare Analysis Configuration task before the build solution step and the  Run Code Analysis task after the build and when I run the Build I got this error :


Any solution please ?

Colin Mueller

unread,
Mar 15, 2018, 10:13:49 AM3/15/18
to SonarQube
Majhoul,

When you're integrating with MSBuild, the SonarQube Scanner has a pretty good idea of what the sources are since you're building it against a solution (rather than say, a repository of code, like you would with the regular command line scanner). In fact, you probably don't need any of the additional properties you've set! Try running analysis without those properties and see if you're successful.

Colin

Majhoul Mahboul

unread,
Mar 15, 2018, 10:21:44 AM3/15/18
to SonarQube
Thank you Colin for your reply.

I did that and still the same problem !

Colin Mueller

unread,
Mar 15, 2018, 10:29:53 AM3/15/18
to SonarQube
Do you have a sonar-project.properties file in your repo somewhere?

Also -- you are sandwiching a Visual Studio Build or MSBuild step, correct?

Colin

Majhoul Mahboul

unread,
Mar 15, 2018, 10:36:23 AM3/15/18
to SonarQube
I do not have a sonar-project.properties in my repo.


I'm using the 'Build Visual Studio'

Colin Mueller

unread,
Mar 15, 2018, 6:29:24 PM3/15/18
to SonarQube
Can you attach a full copy of your TFS build logs (with the system.debug variable set as true)?

Colin

Majhoul Mahboul

unread,
Mar 19, 2018, 5:26:07 AM3/19/18
to SonarQube
Ok.
logs_967.zip

Majhoul Mahboul

unread,
Mar 19, 2018, 6:16:20 AM3/19/18
to SonarQube
You can check this too
logs_974.zip

valeri....@sonarsource.com

unread,
Mar 20, 2018, 5:35:19 AM3/20/18
to SonarQube
Hi,

It seems that you didn't remove the sonar.sources parameter. In general it should not be specified when analyzing with Scanner for MSBuild.

If you open "5_Prepare analysis on SonarQube.txt" in the zip file you sent, you will see that it contains the following text:
2018-03-19T10:07:30.7107000Z ##[debug]extraProperties=sonar.projectBaseDir=D:\agent\_work\43
sonar.sources=s
sonar.sourceEncoding=utf-8
sonar.verbose=true

Kind regards,
Valeri



Monta Mallek

unread,
Mar 20, 2018, 11:27:10 AM3/20/18
to SonarQube
That solves the problem. 

Thank you very much for your help.
Reply all
Reply to author
Forward
0 new messages