SonarQube Scanner 扫描C#代码
SonarQube Scanner
下载SonarQube Scanner for MSBuild
-
下载地址:download
-
将压缩包解压,假设解压到e:/ms文件夹
-
修改SonarQube.Analysis.xml文件
-
<?xml version="1.0" encoding="utf-8" ?> <!-- Project Version] --> <SonarQubeAnalysisProperties xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.sonarsource.com/msbuild/integration/2015/1"> <Property Name="sonar.host.url">sonarQubeServerURL</Property> <Property Name="sonar.login">admin</Property> <Property Name="sonar.password">password</Property> <!-- Required only for versions of SonarQube prior to 5.2 --> <!-- <Property Name="sonar.jdbc.url">jdbc:jtds:sqlserver://mySqlServer/sonar;instance=SQLEXPRESS;SelectMethod=Cursor</Property> <Property Name="sonar.jdbc.username">sonar</Property> <Property Name="sonar.jdbc.password">sonar</Property> --> </SonarQubeAnalysisProperties> -
sonarQubeServerURL :服务器地址
- admin:账号 password:密码
-
扫描代码
-
打开cmd,路径切换到代码文件夹
-
e:\ms\SonarScanner.MSBuild.exe begin /k:"imes_schedule" //imes_schedule/k : 特征码 /n : 解决方案名称 /v:随意
-
"C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe"Rebuild+ 解决方案名称
-
e:\ms\SonarScanner.MSBuild.exe endsonar服务器账号密码,将报告上传服务器