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=“”
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.
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
16:58:58.541 The SonarScanner for MSBuild integration failed: SonarQube was unable to collect the required information about your projects.
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:
: 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
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!