Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
用于.NET核心的Jenkins SonarQube失败,但powershell脚本可以工作_Powershell_Jenkins_Asp.net Core_Msbuild_Sonarqube - Fatal编程技术网

用于.NET核心的Jenkins SonarQube失败,但powershell脚本可以工作

用于.NET核心的Jenkins SonarQube失败,但powershell脚本可以工作,powershell,jenkins,asp.net-core,msbuild,sonarqube,Powershell,Jenkins,Asp.net Core,Msbuild,Sonarqube,我正试图运行詹金斯管道进行声纳分析。我已经编写了一个powershell脚本,可以很好地运行分析;但是,在管道中运行时,结束步骤失败 以下是PowerShell的正确结果: 以下是Jenkins的失败结果: 以下是PowerShell脚本的源代码: & 'C:\Program Files (x86)\Jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\SQScannerMSB\SonarQube.Scanner

我正试图运行詹金斯管道进行声纳分析。我已经编写了一个powershell脚本,可以很好地运行分析;但是,在管道中运行时,
结束
步骤失败

以下是PowerShell的正确结果:

以下是Jenkins的失败结果:

以下是PowerShell脚本的源代码:

& 'C:\Program Files (x86)\Jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\SQScannerMSB\SonarQube.Scanner.MSBuild.exe' begin /k:HC /n:HC /v:1.0 /d:sonar.host.url=http://localhost:9000 /d:sonar.login=REDACTED
& 'C:\Program Files\dotnet\dotnet.exe' msbuild /t:Rebuild
& 'C:\Program Files (x86)\Jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\SQScannerMSB\SonarQube.Scanner.MSBuild.exe' end /d:sonar.login=REDACTED
以下是相关的Jenkins管道代码:

stage('SonarQube') {
    powershell(returnStdout: true, script: '.\\sonar.ps1')
}

从日志来看,它可能与中的问题相同,即作为非本地帐户运行


从v4.1开始,在这种情况下,MSBuild的扫描程序将给出一个特定的警告-请参阅。

比较环境变量,即比较
set
的输出。可能会有不同…谢谢!这就是解决办法!