Version string portion was too short or too long on sonarcloud

I want to use MSBuild for SonarCloud. but i run MSBuild.SonarQube.Runner.exe begin then the system is error as below:

10:34:15.866 Fetching analysis configuration settings…
10:34:17.555 Failed to request and parse ‘https://sonarcloud.io/xxxxx/api/server/version’: Version string portion was too short or too long.
Unhandled Exception: System.ArgumentException: Version string portion was too short or too long.
at System.Version.VersionResult.SetFailure(ParseFailureKind failure, String argument)
at System.Version.TryParseVersion(String version, VersionResult& result)
at System.Version.Parse(String input)
at System.Version…ctor(String version)
at SonarScanner.MSBuild.PreProcessor.SonarWebService.<>c__DisplayClass15_0.b__0()
at SonarScanner.MSBuild.PreProcessor.SonarWebService.DoLogExceptions[T](Func1 op, String url, Action1 onError)
at SonarScanner.MSBuild.PreProcessor.SonarWebService.DownloadServerVersion()
at SonarScanner.MSBuild.PreProcessor.SonarWebService.GetServerVersion()
at SonarScanner.MSBuild.PreProcessor.SonarWebService.GetProperties(String projectKey, String projectBranch)
at SonarScanner.MSBuild.PreProcessor.TeamBuildPreProcessor.FetchArgumentsAndRulesets(ISonarQubeServer server, ProcessedArgs args, TeamBuildSettings settings, IDictionary2& serverSettings, List1& analyzersSettings)
at SonarScanner.MSBuild.PreProcessor.TeamBuildPreProcessor.DoExecute(ProcessedArgs localSettings)
at SonarScanner.MSBuild.BootstrapperClass.PreProcess()
at SonarScanner.MSBuild.BootstrapperClass.Execute()
at SonarScanner.MSBuild.Program.Execute(String args, ILogger logger)
at MSBuild.SonarQube.Runner.Program.Main(String args)

I try to connect request for sonarcloud(https://sonarcloud.io/xxxxx/api/server/version) but it is fail.Pls provide “sonar.host.url” of sonarcloud help me .
Currently, i input on SonarQube.Analysis.xml as:
https://sonarcloud.io/xxxxx/
with sonar qube then url is:sonar.host.url=http://localhost:9000
then request: http://localhost:9000/myPath/api/server/version
so, what is url for sonarcloud?

Hi @VuHuong and welcome to the community !

Why the xxxx at the end ? What it should represents ?

SonarCloud base url is : https://sonarcloud.io/

Mickaël

Hi @mickaelcaro
That’s just my project name on Sonar cloud. I am using via bitbucket.
Is it related to how we configure?

Yes you don’t need to configure it in the URL directly, that will be done after by the Scanner(s).

Currently, I am configuring the on SonarQube.Analysis.xml file as below:
image

Is this config has any problem?

sonar.host.url should just be “https://sonarcloud.io/

I changed the URL but still get issue with below message:

15:52:13.155 Failed to request and parse ‘https://sonarcloud.io/api/settings/values?component=projectKey’: The remote server returned an error: (403) Forbidden.

Do i need to config something on SonarCloud?

Are you using the Scanner for MSBuild in standalone mode ? Like you invoke it in commandline ?

If so, you need to pass a token that you generated on SonarCloud side (https://sonarcloud.io/documentation/user-guide/user-token/) . The user that generates the token should have the “Execute analysis” right, at least.

1 Like

Great. The scanner run successfully.
Thank you for your promptly support.

1 Like