How to analyze existing .cs files with SonarQube S

2019-07-17 13:17发布

问题:

I want to scan existing .cs files with sonarqube.

I understood that I need to use SonarQube Scanner for MSBuild, and this one requires to create a project to analyze. So I created a project on Visual studio from existing files and declared it as Class Library. But while executing SonarQube Scanner for MSBuild, I've got this error:

WARNING: The project has an invalid GUID "00000000-0000-0000-0000-
000000000000". The project will not be analyzed by SonarQube. Project 
file: C:\Users\sas1\Documents\Visual Studio 
2015\Projects\MSBuildTest\MSBuildTest.csproj
No analysable projects were found. SonarQube analysis will not be 
performed. Check the build summary report for details.
Generation of the sonar-properties file failed. Unable to complete 
SonarQube analysis.
09:54:16.866  Creating a summary markdown file...
09:54:16.872  Post-processing failed. Exit code: 1

I can not create a console application with those files, because thus I will have many compilation errors, which I am not supposed to correct, since the code is not mine, but just delegated to me.

So my question is: if someone gives me several .cs files to analyze using SonarQube, how can I analyse them using SonarQube Scanner for MSBuild?

Thank you