简体   繁体   中英

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. but everytime I run my analysis I get this:

16:00:04.919 16:00:04.919 Unrecognized command line argument: /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

The second command you execute should be just msbuild.exe , not 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. If you can't execute it simply look for your MSBuild folder in Program Files (x86), in the end you should execute this:

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

so this should be it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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