首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >“‘reportgenerator”未被识别为内部或外部命令、可操作程序或批处理文件

“‘reportgenerator”未被识别为内部或外部命令、可操作程序或批处理文件
EN

Stack Overflow用户
提问于 2020-07-03 05:12:34
回答 3查看 2.5K关注 0票数 2

当尝试使用'ReportGenerator‘工具作为Azure devops YAML pipleine的一部分来创建报告时,尽管我在上一步中安装了该工具,但还是抛出了下面的错误。

代码语言:javascript
复制
- script: dotnet tool install --global dotnet-reportgenerator-globaltool --version 4.6.1
  displayName: 'Install ReportGenerator tool'
  continueOnError: true

- script: reportgenerator "-reports:$(Agent.TempDirectory)/**/*.cobertura.xml" "-targetdir:$(Build.SourcesDirectory)/coverlet/reports" -reporttypes:Cobertura;htmlInline
  displayName: Generate code coverage report
  continueOnError: true

错误:未将'reportgenerator‘识别为内部或外部命令、可操作程序或批处理文件。##errorCmd.exe已退出,代码为“%1”。

添加日志安装步骤:脚本内容: dotnet工具Install dotnet- reportgenerator -globaltool --工具路径工具--版本4.6.1 ==========================启动命令Output =========================== "C:\windows\system32\cmd.exe“/D /E:ON /V:OFF /S /C "CALL "E:\Agent_work_temp\d9535a65-152b-4822-a4f2-7e58c11f2418.cmd"”您可以使用以下命令调用该工具:reportgenerator工具'dotnet-reportgenerator-globaltool‘(版本'4.6.1')已成功安装。完成:安装ReportGenerator工具

执行工具:脚本内容: reportgenerator "-reports:E:\Agent_work_temp/**/*.cobertura.xml“"-targetdir:E:\Agent_work\79\s/coverlet/reports”-reporttypes:Cobertura;无法将htmlInline ==========================启动命令输出=========================== "C:\windows\system32\cmd.exe“/D /E:ON /V:OFF /S /C "CALL reportgenerator”识别为内部或外部命令、可操作程序或批处理文件。##errorCmd.exe已退出,代码为“%1”。

EN

回答 3

Stack Overflow用户

发布于 2020-07-03 05:26:02

当你在Linux机器上尝试这样做时,会出现a known bug。安装报表生成器后,请尝试添加此附加步骤以更新路径:

代码语言:javascript
复制
- script: echo "##vso[task.prependpath]$HOME/.dotnet/tools"

所以整个解决方案看起来是这样的:

代码语言:javascript
复制
- task: DotNetCoreCLI@2
    displayName: Install ReportGenerator Global Tool
    inputs:
      command: custom
      custom: tool
      arguments: install dotnet-reportgenerator-globaltool -g

- script: echo "##vso[task.prependpath]$HOME/.dotnet/tools"
  displayName: 'Update PATH'

- script: reportgenerator "-reports:$(Agent.TempDirectory)/**/*.cobertura.xml" "-targetdir:$(Build.SourcesDirectory)/coverlet/reports" -reporttypes:Cobertura;htmlInline
  displayName: Generate code coverage report
  continueOnError: true
票数 1
EN

Stack Overflow用户

发布于 2020-07-03 17:53:51

下面的YAML文件可以完成这项工作:

代码语言:javascript
复制
- script: dotnet tool install --tool-path tools dotnet-reportgenerator-globaltool --version 4.6.1
  displayName: 'Install ReportGenerator tool'
  continueOnError: true

- script: ./tools/reportgenerator "-reports:$(Agent.TempDirectory)/**/*.cobertura.xml" "-targetdir:$(Build.SourcesDirectory)/coverlet/reports" "-reporttypes:Cobertura;HtmlInline"

你也可以使用Azure DevOps扩展:

https://marketplace.visualstudio.com/items?itemName=Palmmedia.reportgenerator

用法:

代码语言:javascript
复制
- task: Palmmedia.reportgenerator.reportgenerator-build-release-task.reportgenerator@4
  displayName: ReportGenerator
  inputs:
    reports: '$(Agent.TempDirectory)/**/*.cobertura.xml'
    targetdir: '$(Build.SourcesDirectory)/coverlet/reports'
    reporttypes: 'Cobertura;HtmlInline'
票数 1
EN

Stack Overflow用户

发布于 2020-07-03 17:12:24

这是因为您使用的是自托管代理。在代理上安装新软件后,必须重新启动代理以使新功能显示在池中,以便可以运行构建。

只需转到代理计算机上的任务管理器并重新启动生成代理服务。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62705105

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档