I am getting the error “SonarCloud was unable to collect the required information about your projects.”.
We host our code in BitBucket and use Azure DevOps for our builds.
So I setup the build yaml file like this:
- task: DotNetCoreCLI@2 displayName: Restore nuget packages inputs: command: 'restore' projects: | **/*.csproj feedsToUse: 'select' vstsFeed: '<feed>' - task: UseGitVersion@5 displayName: Set Git Version inputs: versionSpec: '5.x' updateAssemblyInfo: false - task: DotNetCoreCLI@2 displayName: Build projects inputs: command: 'build' arguments: '--configuration $(BuildConfiguration) --no-restore /p:Version=$(GitVersion.NuGetVersion) /p:SourceLinkCreate=true /p:PublicRelease=true' versioningScheme: byBuildNumber - task: SonarCloudPrepare@1 inputs: SonarCloud: 'SonarCloud' organization: '<org>' scannerMode: 'MSBuild' projectKey: '<key>' - task: SonarCloudAnalyze@1 - task: SonarCloudPublish@1 inputs: pollingTimeoutSec: '300'
The build fails on the “SonarCloudAnalyze” task. The Prepare step succeeded.
It gives me 4 possible causes in the error message:
The project has not been built - the project must be built in between the begin and end steps
As you can see I have a build step before the analyze step, so that should not be a problem. This is an existing build with also a unittest step and that one works, so clearly the solution is build.
An unsupported version of MSBuild has been used to build the project. Currently MSBuild 14.0.25420.1 and higher are supported.
On the build step I can see “Microsoft ® Build Engine version 16.8.3+39993bd9d for .NET”. So I think that should be fine.
The begin, build and end steps have not all been launched from the same folder
I didn’t set any custom folders for steps, but this is hard to verify. I don’t see any more information in the build about this.
None of the analyzed projects have a valid ProjectGuid and you have not used a solution (.sln)
The project has a solution, but as you can see in the build step, we do build by project? Could that be the problem?
Can someone help me with this issue? I am not sure how I could get more information to figure out what the problem is here. It is a new configuration, so I probably have something misconfigured or am not understanding something, but not sure how proceed debugging this further.