简体   繁体   English

SonarQube Scanner for MSBuild是否可以在Powershell脚本中运行?

[英]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. 我无法在Powershell脚本中使MSBuild Sonar Runner运行。 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: 但是,在构建(第二步)之后,我注意到$ slnDir / .sonarqube / out目录为空,然后在运行end命令后,我收到标准错误消息:

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? 关于为什么在Powershell中运行msbuild会阻止msbuild生成ProjectInfo.xml输出文件的任何想法?

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: 用于MSBuild的SonarQube扫描仪最适合与MSBuild版本14配合使用。不支持MSBuild 4,这就是为什么看到此未No ProjectInfo.xml files were found. Possible causes: No ProjectInfo.xml files were found. Possible causes: error. No ProjectInfo.xml files were found. Possible causes:错误。 Note that this was mentioned in the few lines under Possible causes ;-) 请注意,在Possible causes下的几行中提到了这一点;-)

For more details, please refer to the official documentation: http://docs.sonarqube.org/x/ahFq 有关更多详细信息,请参阅官方文档: http : //docs.sonarqube.org/x/ahFq

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

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