简体   繁体   English

SonarQube无法识别的命令行参数C#

[英]SonarQube unrecognized command line argument c#

I'm having trouble running a scann for my c# app, I'm trying to scan a simple console application. 我在为我的C#应用​​程序运行scann时遇到麻烦,我正在尝试扫描一个简单的控制台应用程序。 but everytime I run my analysis I get this: 但是每次我进行分析时,我都会得到:

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

So here's the complete command since the beginning: 因此,这是自开始以来的完整命令:

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

Any help fixing this will be appreciatted! 解决此问题的任何帮助将不胜感激!

Thanks. 谢谢。

PD: I'm running sonarqube version 6.7.1 and MSBuild PD:我正在运行声纳古版本6.7.1和M​​SBuild

The second command you execute should be just msbuild.exe , not SonarQube.Scanner.MSBuild.exe . 您执行的第二个命令应该是msbuild.exe ,而不是SonarQube.Scanner.MSBuild.exe

Edit: 编辑:

The problem, is indeed that I have to execute MSBuild.exe instead of the other one but if you can't execute that, it may be because you don't haven't configured your environment varables, and path. 问题的确是我必须执行MSBuild.exe而不是另一个,但是如果您无法执行该程序,则可能是因为您尚未配置环境变量和路径。 If you can't execute it simply look for your MSBuild folder in Program Files (x86), in the end you should execute this: 如果无法执行,则只需在“程序文件”(x86)中查找MSBuild文件夹,最后应执行以下操作:

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

so this should be it. 所以应该是这样。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM