SonarScanner 给出“MsBuild.exe"不被识别为 TFS 2018 上的内部或外部命令 [英] SonarScanner giving 'MsBuild.exe' is not recognized as an internal or external command on TFS 2018

查看:22
本文介绍了SonarScanner 给出“MsBuild.exe"不被识别为 TFS 2018 上的内部或外部命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将 SonarQube 添加到现有的 TFS 2018 版本中.我正在按照此处下载 Community Edition 7.4 的说明进行操作 https://docs.sonarqube.org/display/SCAN/Install+the+SonarScanner+for+MSBuild.

I'm adding SonarQube to existing TFS 2018 builds. I was following the directions for downloading Community Edition 7.4 located here https://docs.sonarqube.org/display/SCAN/Install+the+SonarScanner+for+MSBuild.

完成快速安装指南的步骤 https://docs.sonarqube.org/latest/setup/get-started-2-minutes/我使用以下命令进入要求我从您的计算机执行 MSBuild 扫描程序"的部分:

Going through the steps of the Quick Installation Guide https://docs.sonarqube.org/latest/setup/get-started-2-minutes/ I get to the part where I’m asked to "Execute the Scanner for MSBuild from your computer" using the below commands:

  1. SonarScanner.MSBuild.exe 开始/k:"{key}"/d:sonar.host.url="http://localhost:9000"/d:sonar.login="{key}"
  2. MsBuild.exe/t:Rebuild
  3. SonarScanner.MSBuild.exe end/d:sonar.login="{key}"

当我运行第一个命令时它成功了C:sonar-scanner-msbuild-4.4.2.1543-net46> SonarScanner.MSBuild.exe 开始/k:"{key}"/d:sonar.host.url="http://localhost:9000"/d:sonar.login="{key}"

When I run the first command it succeeds C:sonar-scanner-msbuild-4.4.2.1543-net46> SonarScanner.MSBuild.exe begin /k:"{key}" /d:sonar.host.url="http://localhost:9000" /d:sonar.login="{key}"

用于 MSBuild 4.4.2 的 SonarScanner使用 .NET Framework 版本的 Scanner for MSBuild默认属性文件位于 C:sonar-scanner-msbuild-4.4.2.1543-net46SonarQube.Analysis.xml从 C:sonar-scanner-msbuild-4.4.2.1543-net46SonarQube.Analysis.xml 加载分析属性预处理开始.正在准备工作目录...13:32:09.468 正在更新构建集成目标...13:32:09.5 正在获取分析配置设置...13:32:10.173 为 cs 配置分析器组件...13:32:10.173 安装所需的 Roslyn 分析器...13:32:10.579 为 vbnet 配置分析器组件...13:32:10.579 安装所需的 Roslyn 分析器...13:32:10.735 预处理成功.

SonarScanner for MSBuild 4.4.2 Using the .NET Framework version of the Scanner for MSBuild Default properties file was found at C:sonar-scanner-msbuild-4.4.2.1543-net46SonarQube.Analysis.xml Loading analysis properties from C:sonar-scanner-msbuild-4.4.2.1543-net46SonarQube.Analysis.xml Pre-processing started. Preparing working directories... 13:32:09.468 Updating build integration targets... 13:32:09.5 Fetching analysis configuration settings... 13:32:10.173 Provisioning analyzer assemblies for cs... 13:32:10.173 Installing required Roslyn analyzers... 13:32:10.579 Provisioning analyzer assemblies for vbnet... 13:32:10.579 Installing required Roslyn analyzers... 13:32:10.735 Pre-processing succeeded.

但是,当我运行第二个命令MsBuild.exe/t:Rebuild"时,它失败并出现以下错误:

However when I run the second command "MsBuild.exe /t:Rebuild" It fails with the following error:

C:Program Files (x86)>MsBuild.exe/t:Rebuild'MsBuild.exe' 未被识别为内部或外部命令,可运行的程序或批处理文件.

C:Program Files (x86)>MsBuild.exe /t:Rebuild 'MsBuild.exe' is not recognized as an internal or external command, operable program or batch file.

我确认我添加/更新了环境变量 %PATH%,MsBuild 存在,我想知道 .NET 4.5 框架的说明中是否有未注明的额外步骤?有没有人遇到过使用 TFS 构建的 .NET 的这个错误或有任何想法?

I confirmed I added/updated environmental variables %PATH%, MsBuild exists, I’m wondering if there’s an additional step not noted in the instructions for .NET 4.5 framework? Has anyone come across this error for .NET using TFS builds or has any thoughts?

推荐答案

尝试输入 msbuild 的确切路径,例如对于 VS2017 Professional 命令应该是:

Try to enter exact path of msbuild e.g. for VS2017 Professional command should be:

"C:Program Files (x86)Microsoft Visual Studio2017ProfessionalMSBuild15.0Bin"MsBuild.exe /t:Rebuild

这篇关于SonarScanner 给出“MsBuild.exe"不被识别为 TFS 2018 上的内部或外部命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆