Msbuild for .net framework project failing on github actions


We successfully use sonar cloud on azure pipelines for both JS and .Net with no problems and also for JS on Github actions (using the action).

When running the dotnet scanner on actions for a .net framework build we get the following error:

2022-01-24T19:54:42.2899060Z 19:54:42.289  The SonarScanner for MSBuild integration failed: SonarCloud was unable to collect the required information about your projects.
2022-01-24T19:54:42.2899661Z Possible causes:
2022-01-24T19:54:42.2900116Z   1. The project has not been built - the project must be built in between the begin and end steps
2022-01-24T19:54:42.2900732Z   2. An unsupported version of MSBuild has been used to build the project. Currently MSBuild 14.0.25420.1 and higher are supported.
2022-01-24T19:54:42.2901297Z   3. The begin, build and end steps have not all been launched from the same folder
2022-01-24T19:54:42.2901833Z   4. None of the analyzed projects have a valid ProjectGuid and you have not used a solution (.sln)
2022-01-24T19:54:42.2902482Z 19:54:42.289  Generation of the sonar-properties file failed. Unable to complete the analysis.

We’re using msbuild from VS 2019, and we do have a guid, and the project has been built between the beginning and end steps.

I noticed some topics saying that the need to use a .sln is no longer the case (we’re building a csproj), is this still the case? And sonar reliant on trx files at all?

The only other thing I wondered is can I run the msbuild command against a csproj or .sln in a subfolder, or does the scan need to be happening on a build file at the same folder level? eg.

.\.sonar\scanner\dotnet-sonarscanner begin....
msbuild <folder>/subfolder>/test.csproj
.\.sonar\scanner\dotnet-sonarscanner end....

Any ideas? Thanks for any help.

Please close, no longer an issue.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.