简体   繁体   中英

Can SonarQube Scanner for MSBuild be run from within a powershell script?

I'm having trouble getting the MSBuild Sonar Runner working within a powershell script. Sample script is shown below following the documented procedure of executing all steps from the same directory.

$sonarRunnerPath = "C:\Users\glenn\MSBuild.SonarQube.Runner-2.0\MSBuild.SonarQube.Runner.exe"
$msbuildPath = "$env:WINDIR\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe"

Push-Location $slnDir
& $sonarRunnerPath begin /k:proj:alpha "/n:Project Alpha" /v:1.0.0.%BUILD_NUMBER% /d:sonar.host.url=http://sonar.local
& $msbuildPath /nologo /t:Build /nologo /v:n /clp:ErrorsOnly /m /p:Configuration=Release
& $sonarRunnerPath end

However after building (second step) I notice that the $slnDir/.sonarqube/out directory is empty, then after running the end command I receive the standard error message:

No ProjectInfo.xml files were found. Possible causes:

Any ideas as to why running msbuild within powershell prevents msbuild from producing ProjectInfo.xml output files?

The SonarQube Scanner for MSBuild works best with MSBuild version 14. MSBuild 4 is not supported, which is why you are seeing this No ProjectInfo.xml files were found. Possible causes: No ProjectInfo.xml files were found. Possible causes: error. Note that this was mentioned in the few lines under Possible causes ;-)

For more details, please refer to the official documentation: http://docs.sonarqube.org/x/ahFq

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