Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/308.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何使用SonarQube Scanner for MSBuild分析现有的.cs文件?_C#_Msbuild_Sonarqube_Sonarqube Scan - Fatal编程技术网

C# 如何使用SonarQube Scanner for MSBuild分析现有的.cs文件?

C# 如何使用SonarQube Scanner for MSBuild分析现有的.cs文件?,c#,msbuild,sonarqube,sonarqube-scan,C#,Msbuild,Sonarqube,Sonarqube Scan,我想用sonarqube扫描现有的.cs文件 我知道我需要使用SonarQube Scanner for MSBuild,这需要创建一个项目进行分析。因此,我从现有文件在VisualStudio上创建了一个项目,并将其声明为类库。但在为MSBuild执行SonarQube扫描程序时,我遇到以下错误: WARNING: The project has an invalid GUID "00000000-0000-0000-0000- 000000000000". The project will

我想用sonarqube扫描现有的.cs文件

我知道我需要使用SonarQube Scanner for MSBuild,这需要创建一个项目进行分析。因此,我从现有文件在VisualStudio上创建了一个项目,并将其声明为类库。但在为MSBuild执行SonarQube扫描程序时,我遇到以下错误:

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
我不能用这些文件创建控制台应用程序,因为这样我会有许多编译错误,我不应该纠正这些错误,因为代码不是我的,而是委托给我的

所以我的问题是:如果有人给我几个.cs文件要用SonarQube分析,我怎么能用SonarQube Scanner for MSBuild分析它们呢


谢谢

为什么这个人不给你完整的源代码,包括Visual Studio配置文件?(因为这个人很有可能使用VisualStudio开发这个C#代码)实际上,我们有太多的项目,从每个项目中,我需要分析一个特定的文件。所以我把它们收集在一个文件夹中,需要对它们进行分析。所以从技术上讲,我不必分析整个项目,我只需要一些文件(约占所有项目的5%),我尝试使用sonar runner而不是MSBuild,但wintellectanalyzers插件的存在不可能实现(我需要开发自定义规则)。我收到以下错误:错误:SonarQube扫描程序执行过程中出错java.lang.IllegalArgumentException:自定义和第三方Roslyn分析器仅由MSBuild 14提供。请使用MSBuild 14,或在质量配置文件中禁用自定义/第三方Roslyn分析器。很抱歉,此“不寻常”用例不包括在内。我不知道每个项目只分析1个文件的确切原因,但如果这是您的一个强烈要求,那么您将无法正确实现这一点,除非开发团队将所有这些文件捆绑到正确配置的解决方案中。谢谢您的回答。我发现分析特定文件的唯一方法是使用sonar runner,而不使用第三方Roslyn analyzer(即在包含这些文件的文件夹中执行C:\sonar scanner\bin\sonar-scanner.bat)。这对于其他语言(php、java、javascript)也是可能的,我只是想知道使用sonar runner或SonarQube Scanner for MSBuild进行分析是否有区别,因为官方文档要求使用SonarQube Scanner for MSBuild而不是sonar runner。非常感谢。