We have executed below commands and using C# scanner but we are getting error in below last command as “The SonarScanner for MSBuild was failed:SonarQube was unable to collect the required information about your projects”
Commands we used:
SonarScanner.MSBuild.exe begin /k:“eI.” /d:sonar.host.url=“” /d:sonar.login=“”
Note: In the Developer system java 17 is installed for .net sonarscanner 4.7
Could you please check and let us know the possible resolution for the above issue?
We have updated the Latest sonar Scanner as you suggested, but still getting the same error.
Attaching the full logs below:
D:\Projects\Propel\New ADO Repos>MSBuild.exe D:\Projects\Propel\New ADO Repos /t:Rebuild
Microsoft (R) Build Engine version 16.11.2+f32259642 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
MSBUILD : error MSB1008: Only one project can be specified.
Switch: ADO
For switch syntax, type “MSBuild -help”
D:\Projects\Propel\New ADO Repos>SonarScanner.MSBuild.exe end /d:sonar.login=“”
SonarScanner for MSBuild 6.0
Using the .NET Framework version of the Scanner for MSBuild
Post-processing started.
16:58:58.541 The SonarScanner for MSBuild integration failed: SonarQube was unable to collect the required information about your projects.
Possible causes:
The project has not been built - the project must be built in between the begin and end steps
An unsupported version of MSBuild has been used to build the project. Currently MSBuild 14.0.25420.1 and higher are supported.
The begin, build and end steps have not all been launched from the same folder
None of the analyzed projects have a valid ProjectGuid and you have not used a solution (.sln)
16:58:58.542 Generation of the sonar-properties file failed. Unable to complete the analysis.
16:58:58.543 sonar-project.properties files are not understood by the SonarScanner for MSBuild. Remove those files from the following folders: D:\Projects\Propel\New ADO Repos
We have changed as you suggested from directory to a specific solution, but now we are getting another below error:
C:\Program Files\dotnet\sdk\3.1.426\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(241,5)
: error NETSDK1005: Assets file ‘D:\Projects\pr\New ADO Repos\pr-assetmanagement\pr.AssetManagement.Service
\obj\project.assets.json’ doesn’t have a target for ‘.NETFramework,Version=v6.0’. Ensure that restore has run and that
you have included ‘net60’ in the TargetFrameworks for your project. [D:\Projects\pr\New ADO Repos\pr-assetmanag
ement\pr.AssetManagement.Service\pr.AssetManagement.Service.csproj]
Note: We have checked, the target .net version is also same as installed .net version.
At this point, this is an issue with your build, not with SonarQube (you would face the same issue trying to build your code without SonarQube). Unfortunately I won’ t able to help you get your code compiling – but once it compiles correctly, if you still face issues with SonarQube integration let us know!