[英]Analyze c# code with sonarQube: MSBUILD version problems
我需要分析各种C#文件(不是项目,而只是放在同一个目录下的.cs文件)。
我以两种不同的方式尝试了分析,但每种方法都有错误。 有人可以帮助解决任何这些错误吗?
1-我尝试了这里提到的分析
通过在根文件中执行C:\\ sonar-scanner \\ bin \\ sonar-scanner.bat,我有此错误
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 Scanner for MSBuild进行分析
但是最后,我出现了这个错误
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 Studio 2015、2012、2010、2008。 我如何验证我使用的是正确的MSBUILD版本(14),因为我检查了C:\\ Program Files(x86)\\ MSBuild,并且在那里找到了版本14。
还有其他问题要处理吗?
最后,我需要能够以第一种和第二种方式进行分析。
先感谢您!
2-我厌倦了创建项目并使用SonarQube Scanner for MSBuild进行分析
根据文档,我们需要从要分析的项目的根文件夹中执行以下命令:
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是外部命令,Windows无法在任意目录中识别,您应该在系统环境中将MSBuild路径“ C:\\ Program Files(x86)\\ MSBuild \\ 14.0 \\ Bin”添加到使开始,构建或结束步骤都从同一文件夹启动。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.