Skip to content

Latest commit

 

History

History
54 lines (49 loc) · 1.99 KB

File metadata and controls

54 lines (49 loc) · 1.99 KB

环境说明

  • Windows 10 v1803
  • Docker Version 18.03.1-ce-win65
  • JDK1.8
  • .NET Core 2.x

准备条件

  • 使用docker-compose准备Sonarqube环境
  • 本地安装dotnet-sonarscaner工具
dotnet tool install --global dotnet-sonarscanner --version 4.3.1

启动Sonarqube:

  • 打开命令行,切换到此目录
  • 运行命令:
docker-compose up
docker-compose restart sonarqube

扫描代码

dotnet sonarscanner begin /k:"TestProject" /d:sonar.host.url="http://localhost:9000" /d:sonar.login="cfe594fd605f2e4821835e43c69da82e489c2f23"
dotnet build
dotnet sonarscanner end /d:sonar.login="cfe594fd605f2e4821835e43c69da82e489c2f23"

注意事项

  • 本地需安装配置JDK,否则执行dotnet sonarscanner end会失败
  • 如果是对整个解决方案进行扫描,或目录下有多个项目时,需在dotnet build命令后添加要扫描的解决方案或项目,如
dotnet build ./test.sln

参考