Scanner for MSBuild unable to collect information for C#

Hi,

I am facing same kind of issue, I am doing following steps:

1] I am doing the begin step and it works.
2] I am doing build the project and it return 0 errors.
3] When I am doing the end step it return
SonarScanner for MSBuild 4.7.1
Using the .NET Core version of the Scanner for MSBuild
Post-processing started.
The SonarQube MSBuild integration failed: SonarQube was unable to collect the required information about your projects.
Possible causes:

  1. The project has not been built - the project must be built in between the begin and end steps
  2. An unsupported version of MSBuild has been used to build the project. Currently MSBuild 14.0.25420.1 and higher are supported.
  3. The begin, build and end steps have not all been launched from the same folder
  4. None of the analyzed projects have a valid ProjectGuid and you have not used a solution (.sln)
    Generation of the sonar-properties file failed. Unable to complete SonarQube analysis.
    16:18:48.928 Post-processing failed. Exit code: 1

Also, I am attaching the sonarcube zip file. Please let me know how I can resolve this error.
.sonarqube.zip (70.4 KB)

Thank you,
Sanket Vyas

Hi @Sanket_Vyas. Welcome to the community.

  • Are you building a single MSBuild project, or a solution?
  • Try building the project with more verbose MSBuild logging turned on e.g. pass -v:detailed in your donet build command. Does the output contain any messages starting with “Sonar:”?

Hi @duncanp,

1] I am building a solution.
2] I have run the MSBuild command with -v:detailed not finding anything with “Sonar.”

image
image
image

Also,attached the sonarcube.zip file.
.sonarqube.zip (70.4 KB)

Thank You,
Sanket Vyas

All of the commands (begin, build, end) need to be run from the same directory. Are you running the MSBuild command from a different directory?

Yes my MsBuild.exe is located into below location.

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin

Thank You,
Sanket Vyas

All of the commands need to be run from the same directory.

It looks like you are using a normal command prompt. Use the Developer Command prompt for Visual Studio 2017 instead. It is configured to add msbuild.exe to the path, so you don’t need to change directory.

1 Like

Hi,

It worked when I have used the developer Command prompt for Visual Studio 2017 and run all command (begin, build, end) from the same command prompt.

Thanks for helping to resolve this issue.

Thank You,
Sanket Vyas

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