【问题标题】:SonarQube unrecognized command line argument c#SonarQube无法识别的命令行参数c#
【发布时间】:2018-07-05 06:58:22
【问题描述】:

我在为我的 c# 应用程序运行扫描时遇到问题,我正在尝试扫描一个简单的控制台应用程序。但每次我进行分析时,我都会得到:

16:00:04.919 16:00:04.919 无法识别的命令行参数:/t:Rebuild

所以这是从一开始的完整命令:

PS C:\Users\danie\documents\Visual Studio 2015\Projects\ConsoleApplication1> C:\SonarQube-Scanner-for-MSBuild\SonarQube.Scanner.MSBuild.exe begin /k:"ConsoleApplication1" /n:"ConsoleApplication1"/v:"1.0"
SonarQube Scanner for MSBuild 4.0.2
Default properties file was found at C:\SonarQube-Scanner-for-
MSBuild\SonarQube.Analysis.xml
Loading analysis properties from C:\SonarQube-Scanner-for-
MSBuild\SonarQube.Analysis.xml
Pre-processing started.
Preparing working directories...
16:13:12.659  Updating build integration targets...
16:13:12.674  Fetching analysis configuration settings...
16:13:13.051  Provisioning analyzer assemblies for cs...
16:13:13.052  Installing required Roslyn analyzers...
16:13:13.152  Pre-processing succeeded.
PS C:\Users\danie\documents\Visual Studio 2015\Projects\ConsoleApplication1> 
C:\SonarQube-Scanner-for-MSBuild\SonarQube.Scanner.MSBuild.exe /t:Rebuild
SonarQube Scanner for MSBuild 4.0.2
Default properties file was found at C:\SonarQube-Scanner-for-
MSBuild\SonarQube.Analysis.xml
Loading analysis properties from C:\SonarQube-Scanner-for-
MSBuild\SonarQube.Analysis.xml
WARNING: Please specify the command 'begin' or 'end' to indicate whether 
pre- or post-processing is required. These parameters will become mandatory 
in a later release.
Pre-processing started.
Preparing working directories...
16:13:17.069  16:13:17.053  Unrecognized command line argument: /t:Rebuild
16:13:17.069  16:13:17.053  A required argument is missing: /key:[SonarQube 
project key]
16:13:17.069  Expecting at least the following command line argument:
- SonarQube project key
When connecting to a SonarQube server earlier than version 6.1, the following command line arguments are also required:
- SonarQube project name
- SonarQube project version
The full path to a settings file can also be supplied. If it is not supplied, the exe will attempt to locate a default settings file in the same directory as the SonarQube Scanner for MSBuild.

Use '/?' or '/h' to see the help message.
16:13:17.084  Pre-processing failed. Exit code: 1

任何解决此问题的帮助将不胜感激!

谢谢。

PD:我正在运行 sonarqube 版本 6.7.1 和 MSBuild

【问题讨论】:

    标签: c# sonarqube


    【解决方案1】:

    您执行的第二个命令应该只是msbuild.exe,而不是SonarQube.Scanner.MSBuild.exe

    编辑:

    问题,确实是我必须执行 MSBuild.exe 而不是另一个,但如果你不能执行,可能是因为你没有配置你的环境变量和路径。如果您无法执行它,只需在 Program Files (x86) 中查找您的 MSBuild 文件夹,最后您应该执行以下操作:

    'C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe' /t:Rebuild
    

    应该是这样的。

    【讨论】:

      猜你喜欢
      • 2011-11-14
      • 1970-01-01
      • 2020-04-11
      • 1970-01-01
      • 1970-01-01
      • 2015-06-29
      • 2017-11-19
      • 1970-01-01
      • 2016-06-10
      相关资源
      最近更新 更多