Stuggling to run my C# project


(Eron) #1

MSBUild.SonarQube.Runner.exe /k:“DNG2” /t:Rebuild failseach time


(Scott) #2

Hi.

Please read the documentation carefully: https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+MSBuild

You are executing MSBUild.SonarQube.Runner.exe (...) /t:Rebuild. The /t:Rebuild is a parameter of msbuild.exe (and not from MSBUild.SonarQube.Runner.exe), you’re executing the wrong command.


(Eron) #3
C:\Projects\Application_Central - Copy2018_12_31_new - Copy>MSBUild.SonarQube.Runner.exe begin /k:"DNG2"
WARNING: ------------------------------------------------------------------------
This executable is deprecated and may be removed in next major version of the SonarScanner for MSBuild. Please use 'SonarScanner.MSBuild.exe' instead.
------------------------------------------------------------------------
SonarScanner for MSBuild 4.5
Using the .NET Framework version of the Scanner for MSBuild
Default properties file was found at C:\SonarScanner\MSBUILD\SonarQube.Analysis.xml
Loading analysis properties from C:\SonarScanner\MSBUILD\SonarQube.Analysis.xml
Pre-processing started.
Preparing working directories...
11:04:14.112  Updating build integration targets...
11:04:14.18  Fetching analysis configuration settings...
11:04:22.359  Provisioning analyzer assemblies for cs...
11:04:22.363  Installing required Roslyn analyzers...
11:04:23.044  Pre-processing succeeded.

C:\Projects\Application_Central - Copy2018_12_31_new - Copy>MSBUild.SonarQube.Runner.exe /t:Rebuild
WARNING: ------------------------------------------------------------------------
This executable is deprecated and may be removed in next major version of the SonarScanner for MSBuild. Please use 'SonarScanner.MSBuild.exe' instead.
------------------------------------------------------------------------
SonarScanner for MSBuild 4.5
Using the .NET Framework version of the Scanner for MSBuild
Default properties file was found at C:\SonarScanner\MSBUILD\SonarQube.Analysis.xml
Loading analysis properties from C:\SonarScanner\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...
11:04:58.242  11:04:58.231  Unrecognized command line argument: /t:Rebuild
11:04:58.246  11:04:58.238  A required argument is missing: /key:[SonarQube project key]
11:04:58.249  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.
11:04:58.253  Pre-processing failed. Exit code: 1

C:\Projects\Application_Central - Copy2018_12_31_new - Copy>MSBUild.SonarQube.Runner.exe /k:"DNG2" /t:Rebuild
WARNING: ------------------------------------------------------------------------
This executable is deprecated and may be removed in next major version of the SonarScanner for MSBuild. Please use 'SonarScanner.MSBuild.exe' instead.
------------------------------------------------------------------------
SonarScanner for MSBuild 4.5
Using the .NET Framework version of the Scanner for MSBuild
Default properties file was found at C:\SonarScanner\MSBUILD\SonarQube.Analysis.xml
Loading analysis properties from C:\SonarScanner\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...
11:06:06.726  11:06:06.713  Unrecognized command line argument: /t:Rebuild
11:06:06.731  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.
11:06:06.736  Pre-processing failed. Exit code: 1

C:\Projects\Application_Central - Copy2018_12_31_new - Copy>M

(Scott) #4

Hi.

Sorry, but did you even read my last answer?

I can see these 3 commands in your log:

MSBUild.SonarQube.Runner.exe begin /k:"DNG2"
MSBUild.SonarQube.Runner.exe /t:Rebuild
MSBUild.SonarQube.Runner.exe /k:"DNG2" /t:Rebuild

But the correct way is something like:

MSBuild.SonarQube.Runner.exe begin /k:"DNG2"
msbuild /t:Rebuild
MSBuild.SonarQube.Runner.exe end

And please, again, read the documentation here: https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+MSBuild

By the way, you’re using the old MSBuild.SonarQube.Runner, you should prefer the newer SonarScanner.MSBuild.exe instead.


(Eron) #5

Ok Scott Ive gone back to the documentation. I ve used the newer MSBuild.exe and I’m seeing this error.
C:\Application_Central>SonarQube.Scanner.MSBuild.exe begin /k:“DNG2” /d:sonar.host.url=“http://localhost:9000” /d:sonar.login=“f7f88f0db6917b05788007b5804fa98fbe4de980”
‘SonarQube.Scanner.MSBuild.exe’ is not recognized as an internal or external command,
operable program or batch file.

I have tried a million different things and have no idea where I’m going wrong. The SonarQube server is up and running. I need some help


(Eron) #6

Maybe in my frustration I did not read this correctly Im going to try again