We are using SonarQube * Version 8.4.2 (build 36762) installed in a container.
the scanner is installed as a global tool and is version 4.10
I am successful running the scan of my C# solution directly from the command prompt visual studio 2019. i am however, not successful when taking those same commands and placing begin and end into the pre and post-build respectively.
my version of msbuild is 16.4.
I have confirmed the projects have unique GUIDs in the .sln file
I have tried clean build and also re-build. I have checked my BIN folder and there is application output.
the fact that it works from command line but not from within visual studio does suggest user error but alas, it is not obvious to me why it doesn’t work.
Visual Studio is running as administrator
The sonarqube config file is default. I am passing the token and projectID and host URI as command line parameters in the build-events.
The debug output of the end command is the following:
1>12:54:34.085 Pre-processing succeeded. 1>TollBooth -> C:\Users\ejensen\source\repos\TollBooth\TollBooth\bin\Debug\netcoreapp2.1\bin\TollBooth.dll 1>SonarScanner for MSBuild 4.10 1>Using the .NET Core version of the Scanner for MSBuild 1>Post-processing started. 1>12:54:38.518 12:54:38.501 Uninstalling target: C:\Users\ejensen\AppData\Local\Microsoft\MSBuild\4.0\Microsoft.Common.targets\ImportBefore\SonarQube.Integration.ImportBefore.targets 1>12:54:38.518 12:54:38.503 Uninstalling target: C:\Users\ejensen\AppData\Local\Microsoft\MSBuild\10.0\Microsoft.Common.targets\ImportBefore\SonarQube.Integration.ImportBefore.targets 1>12:54:38.518 12:54:38.505 Uninstalling target: C:\Users\ejensen\AppData\Local\Microsoft\MSBuild\11.0\Microsoft.Common.targets\ImportBefore\SonarQube.Integration.ImportBefore.targets 1>12:54:38.518 12:54:38.507 Uninstalling target: C:\Users\ejensen\AppData\Local\Microsoft\MSBuild\12.0\Microsoft.Common.targets\ImportBefore\SonarQube.Integration.ImportBefore.targets 1>12:54:38.518 12:54:38.508 Uninstalling target: C:\Users\ejensen\AppData\Local\Microsoft\MSBuild\14.0\Microsoft.Common.targets\ImportBefore\SonarQube.Integration.ImportBefore.targets 1>12:54:38.518 12:54:38.51 Uninstalling target: C:\Users\ejensen\AppData\Local\Microsoft\MSBuild\15.0\Microsoft.Common.targets\ImportBefore\SonarQube.Integration.ImportBefore.targets 1>12:54:38.518 12:54:38.511 Uninstalling target: C:\Users\ejensen\AppData\Local\Microsoft\MSBuild\Current\Microsoft.Common.targets\ImportBefore\SonarQube.Integration.ImportBefore.targets 1>12:54:38.518 12:54:38.518 sonar.verbose=true was specified - setting the log verbosity to 'Debug' 1>12:54:38.519 Loading the SonarQube analysis config from C:\Users\ejensen\source\repos\TollBooth\TollBooth\.sonarqube\conf\SonarQubeAnalysisConfig.xml 1>12:54:38.519 Not running under TeamBuild 1>12:54:38.519 Analysis base directory: C:\Users\ejensen\source\repos\TollBooth\TollBooth\.sonarqube 1>Build directory: 1>Bin directory: C:\Users\ejensen\source\repos\TollBooth\TollBooth\.sonarqube\bin 1>Config directory: C:\Users\ejensen\source\repos\TollBooth\TollBooth\.sonarqube\conf 1>Output directory: C:\Users\ejensen\source\repos\TollBooth\TollBooth\.sonarqube\out 1>Config file: C:\Users\ejensen\source\repos\TollBooth\TollBooth\.sonarqube\conf\SonarQubeAnalysisConfig.xml 1>Generating SonarQube project properties file to C:\Users\ejensen\source\repos\TollBooth\TollBooth\.sonarqube\out\sonar-project.properties 1>The SonarQube MSBuild integration failed: SonarQube was unable to collect the required information about your projects. 1>Possible causes: 1> 1. The project has not been built - the project must be built in between the begin and end steps 1> 2. An unsupported version of MSBuild has been used to build the project. Currently MSBuild 14.0.25420.1 and higher are supported. 1> 3. The begin, build and end steps have not all been launched from the same folder 1> 4. None of the analyzed projects have a valid ProjectGuid and you have not used a solution (.sln) 1>Writing processing summary to C:\Users\ejensen\source\repos\TollBooth\TollBooth\.sonarqube\out\ProjectInfo.log 1>Generation of the sonar-properties file failed. Unable to complete SonarQube analysis. 1>12:54:38.549 Post-processing failed. Exit code: 1
I am wondering if perhaps it’s the 3rd point around folders but I am not sure if I am to correct that in my .csproj or .sln files. I tried cd $(SolutionPath) before the begin and end commands and it did not affect the result.