I am trying to integrate mvc project with Azure Devops Pipeline and also to integrate Sonarcloud for the code Quality.
But, the analysis is failing with an error:
SonarScanner for MSBuild 5.13
Using the .NET Framework version of the Scanner for MSBuild
Post-processing started.
##[error]19:51:38.843 The SonarScanner for MSBuild integration failed: SonarCloud 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)
19:51:38.843 The SonarScanner for MSBuild integration failed: SonarCloud 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)
19:51:38.843 Generation of the sonar-properties file failed. Unable to complete the analysis.
##[error]19:51:38.874 Post-processing failed. Exit code: 1
19:51:38.874 Post-processing failed. Exit code: 1
##[error]The process ‘E:\dev_tasks\SonarCloudPrepare_14d9cde6-c1da-4d55-aa01-2965cd301255\1.35.0\classic-sonar-scanner-msbuild\SonarScanner.MSBuild.exe’ failed with exit code 1
Finishing: SonarCloudAnalyze
Pipeline YML File:
ASP.NET Core
Build and test ASP.NET Core projects targeting .NET Core.
Add steps that run tests, create a NuGet package, deploy, and more:
Build, test, and deploy .NET Core apps - Azure Pipelines | Microsoft Learn
trigger:
- master
pool: Default
variables:
buildConfiguration: ‘Release’
steps:
-
script: dotnet build --configuration $(buildConfiguration)
displayName: ‘dotnet build $(buildConfiguration)’ -
task: SonarCloudPrepare@1
inputs:
SonarCloud: ‘SonarCloud’
organization: ‘poconsonarcloud’
scannerMode: ‘MSBuild’
projectKey: ‘POConSonarCloud_SonarCloudProject’
projectName: ‘SonarCloudProject’ -
task: SonarCloudAnalyze@1
-
task: SonarCloudPublish@1
inputs:
pollingTimeoutSec: ‘300’