用sonarQube分析c#代码:MSBUILD版本问题
Analyze c# code with sonarQube: MSBUILD version problems
我需要分析各种C#文件(不是项目,只是放在同一目录下的.cs文件)。
我尝试了两种不同的分析方法,但每种方法都有错误。有人可以帮助解决这些错误吗?
1- 我尝试了上面提到的分析 here
在根文件中执行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- I tired creating a project and analyzing with 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在任意目录下识别,你应该在"C:\Program Files (x86)\MSBuild.0\Bin"中添加MSBuild路径到您的系统环境 使开始、构建或结束步骤都从同一个文件夹启动。
我需要分析各种C#文件(不是项目,只是放在同一目录下的.cs文件)。
我尝试了两种不同的分析方法,但每种方法都有错误。有人可以帮助解决这些错误吗?
1- 我尝试了上面提到的分析 here
在根文件中执行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- I tired creating a project and analyzing with 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在任意目录下识别,你应该在"C:\Program Files (x86)\MSBuild.0\Bin"中添加MSBuild路径到您的系统环境 使开始、构建或结束步骤都从同一个文件夹启动。