Hello, we are using .NET SonarScanner for MSBuild version 4.8 and suddenly, we getting an error at the start of analysis:
dotnet sonarscanner begin /s:/app/shared/SonarQube.Analysis.xml /k:k2-shared /v:10.13.0"-k2-3247-e8ca944" /d:sonar.cs.vstest.reportsPaths="/app/shared/test/TestResults/*TestResults.trx" /d:sonar.cs.opencover.reportsPaths="/app/shared/test/TestResults/*TestCoverage.xml" /d:sonar.verbose=true /d:sonar.branch.name="feature/k2-3247" /d:sonar.branch.target="develop"
SonarScanner for MSBuild 4.8
Using the .NET Core version of the Scanner for MSBuild
Loading analysis properties from /app/shared/SonarQube.Analysis.xml
sonar.verbose=true was specified - setting the log verbosity to 'Debug'
Pre-processing started.
Preparing working directories...
Using environment variables to determine the download directory...
11:11:23.268 11:11:23.263 Loading analysis properties from /app/shared/SonarQube.Analysis.xml
11:11:23.268 11:11:23.268 sonar.verbose=true was specified - setting the log verbosity to 'Debug'
11:11:23.27 Updating build integration targets...
11:11:23.273 Installed SonarQube.Integration.ImportBefore.targets to /root/.local/share/Microsoft/MSBuild/4.0/Microsoft.Common.targets/ImportBefore
11:11:23.274 Installed SonarQube.Integration.ImportBefore.targets to /root/.local/share/Microsoft/MSBuild/10.0/Microsoft.Common.targets/ImportBefore
11:11:23.274 Installed SonarQube.Integration.ImportBefore.targets to /root/.local/share/Microsoft/MSBuild/11.0/Microsoft.Common.targets/ImportBefore
11:11:23.275 Installed SonarQube.Integration.ImportBefore.targets to /root/.local/share/Microsoft/MSBuild/12.0/Microsoft.Common.targets/ImportBefore
11:11:23.275 Installed SonarQube.Integration.ImportBefore.targets to /root/.local/share/Microsoft/MSBuild/14.0/Microsoft.Common.targets/ImportBefore
11:11:23.275 Installed SonarQube.Integration.ImportBefore.targets to /root/.local/share/Microsoft/MSBuild/15.0/Microsoft.Common.targets/ImportBefore
11:11:23.276 Installed SonarQube.Integration.ImportBefore.targets to /root/.local/share/Microsoft/MSBuild/Current/Microsoft.Common.targets/ImportBefore
11:11:23.276 Installed SonarQube.Integration.ImportBefore.targets to /root/Microsoft/MSBuild/15.0/Microsoft.Common.targets/ImportBefore
11:11:23.276 Installed SonarQube.Integration.ImportBefore.targets to /root/Microsoft/MSBuild/Current/Microsoft.Common.targets/ImportBefore
11:11:23.277 Installed SonarQube.Integration.targets to /app/shared/.sonarqube/bin/targets
11:11:23.278 Creating config and output folders...
11:11:23.278 Creating directory: /app/shared/.sonarqube/conf
11:11:23.278 Creating directory: /app/shared/.sonarqube/out
11:11:23.285 Fetching analysis configuration settings...
11:11:23.286 Downloading from https://sonarcloud.io/api/server/version...
11:11:23.583 Fetching properties for project 'k2-shared' from https://sonarcloud.io/api/settings/values?component=k2-shared...
11:11:23.584 Downloading from https://sonarcloud.io/api/settings/values?component=k2-shared...
11:11:23.843 Downloading from https://sonarcloud.io/api/languages/list...
11:11:23.89 Fetching quality profile for project 'k2-shared' from https://sonarcloud.io/api/qualityprofiles/search?projectKey=k2-shared...
11:11:23.89 Downloading from https://sonarcloud.io/api/qualityprofiles/search?projectKey=k2-shared...
11:11:23.945 Failed to request and parse 'https://sonarcloud.io/api/qualityprofiles/search?projectKey=k2-shared': The remote server returned an error: (400) .
Unhandled exception. System.Net.WebException: The remote server returned an error: (400) .
at System.Net.HttpWebRequest.GetResponse()
at System.Net.WebClient.GetWebResponse(WebRequest request)
at System.Net.WebClient.DownloadBits(WebRequest request, Stream writeStream)
at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request)
at System.Net.WebClient.DownloadString(Uri address)
at System.Net.WebClient.DownloadString(String address)
at SonarScanner.MSBuild.PreProcessor.WebClientDownloader.<>c__DisplayClass5_0.<TryDownloadIfExists>b__0()
at SonarScanner.MSBuild.PreProcessor.WebClientDownloader.DoIgnoringMissingUrls(Action op)
at SonarScanner.MSBuild.PreProcessor.WebClientDownloader.TryDownloadIfExists(String url, String& contents)
at SonarScanner.MSBuild.PreProcessor.SonarWebService.<>c__DisplayClass6_0.<TryGetQualityProfile>b__0()
at SonarScanner.MSBuild.PreProcessor.SonarWebService.DoLogExceptions[T](Func`1 op, String url, Action`1 onError)
at SonarScanner.MSBuild.PreProcessor.SonarWebService.TryGetQualityProfile(String projectKey, String projectBranch, String organization, String language, String& qualityProfileKey)
at SonarScanner.MSBuild.PreProcessor.TeamBuildPreProcessor.FetchArgumentsAndRulesets(ISonarQubeServer server, ProcessedArgs args, TeamBuildSettings settings, IDictionary`2& serverSettings, List`1& analyzersSettings)
at SonarScanner.MSBuild.PreProcessor.TeamBuildPreProcessor.DoExecute(ProcessedArgs localSettings)
at SonarScanner.MSBuild.PreProcessor.TeamBuildPreProcessor.Execute(String[] args)
at SonarScanner.MSBuild.BootstrapperClass.PreProcess()
at SonarScanner.MSBuild.BootstrapperClass.Execute()
at SonarScanner.MSBuild.Program.Execute(String[] args, ILogger logger)
at SonarScanner.MSBuild.Program.Execute(String[] args, Boolean showDeprecatedWarning)
at SonarScanner.MSBuild.Program.Main(String[] args)
If you click on the link in the error message, you get this error:
{"errors":[{"msg":"The 'organization' parameter is missing"}]}
This is how the SonarQube.Analysis.xml
file looks like:
<?xml version="1.0" encoding="utf-8" ?>
<SonarQubeAnalysisProperties xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.sonarsource.com/msbuild/integration/2015/1">
<Property Name="sonar.host.url">https://sonarcloud.io</Property>
<Property Name="sonar.organization">alza</Property>
<Property Name="sonar.login">xxx</Property>
<Property Name="sonar.sources">src/*,src-packages/*</Property>
<Property Name="sonar.exclusions">src/**/wwwroot/*,src/**/Assets/Migrations/*</Property>
</SonarQubeAnalysisProperties>
As you can see, the organization is set properly in the XML file…
As a matter of fact, I don’t think we changed anything at all and suddely, this error occurs… Can you help please? Thank you
PS: The dotnet tool is installed as following:
dotnet tool install --global dotnet-sonarscanner --version 4.8.0