首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用c#:MSBUILD版本问题分析sonarQube代码

用c#:MSBUILD版本问题分析sonarQube代码
EN

Stack Overflow用户
提问于 2017-07-04 14:28:02
回答 1查看 1.3K关注 0票数 0

我需要分析各种C#文件(不是一个项目,只是放在同一个目录下的.cs文件)。

我尝试了两种不同的分析方法,每种方法都有错误。有人能帮忙解决这些错误吗?

我试过像上面提到的这里那样进行分析

通过在根文件中执行C:\sonar-扫描器\bin\sonar-scanner.bat,我有以下错误

代码语言:javascript
复制
ERROR: Error during SonarQube Scanner execution
java.lang.IllegalArgumentException: Custom and 3rd party Roslyn analyzers 
are only by MSBuild 14. Either use MSBuild 14, or disable the custom/3rd 
party Roslyn analyzers in your quality profile.

2-我厌倦了创建一个项目并使用SonarQube MSBuild扫描仪进行分析

但在最后,我出现了一个错误

代码语言:javascript
复制
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 upwards are supported
 3. The begin, build or end steps have not all been launched from the 
 same folder
 Generation of the sonar-properties file failed. Unable to complete 
 SonarQube analysis.

我安装了Visual 2015,2012,2010,2008。如何验证我使用的是正确的MSBUILD verison ( 14 ),因为我检查了C:\Program (x86)\MSBuild,并在那里找到了版本14。

还有别的问题要处理吗?

最后,我需要能够用第一种和第二种方式进行分析。

提前谢谢你!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-07-05 10:35:58

2-我厌倦了创建一个项目,并使用SonarQube扫描仪进行MSBuild分析。

根据文档,我们需要从要分析的项目的根文件夹执行以下命令:

代码语言:javascript
复制
SonarQube.Scanner.MSBuild.exe begin /k:"org.sonarqube:sonarqube-scanner-msbuild" /n:"Project Name" /v:"1.0"
MSBuild.exe /t:Rebuild
SonarQube.Scanner.MSBuild.exe end

但是命令MSBuild.exe是一个外部命令,在任意目录下都无法被识别,您应该将MSBuild路径"C:\Program (x86)\MSBuild\14.0\Bin“添加到系统环境中,使开始、生成或结束步骤都从同一个文件夹中启动。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44908532

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档