[英]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.