Azure-pipelines-tasks: dotnet cli Reportgenerator custom command fails

Created on 31 Jan 2019  路  4Comments  路  Source: microsoft/azure-pipelines-tasks

When i try to add a custom dotnet.exe task (reportgenerator), the command fails with the following message.

No executable found matching command "dotnet-reportgenerator"

I have tried all the combinations as mentioned here: https://github.com/Microsoft/azure-pipelines-tasks/issues/7194

Any help is appreciated.

image

Release

Most helpful comment

@jilpansi @ThomasBDO

You need to do dotnet restore, for dotnet-reportgenerator-cli to work. You can do it by repeating the DotNetCoreCLI task, with 'restore' as command, and point to the correct csproj.

@RTodorov

You can install the tool globally, by

  - task: DotNetCoreCLI@2
    displayName: Install ReportGenerator Global Tool
    inputs:
      command: custom
      custom: tool
      arguments: install dotnet-reportgenerator-globaltool -g

And then add a CommandLine script to the pipeline, to execute

reportgenerator <Arguments>

If you're installing the tool locally, you need to reference it by ./
eg:) ./reportgenerator

Issue with Linux:
We found a bug in Linux agent, where the PATH is not updating after global installation of dotnet tools. To workaround this, you need to add another CommandLine script before calling reportgenerator:

echo "##vso[task.prependpath]$HOME/.dotnet/tools"

Please note it needs to be a seperate task, before reportgenerator is used
Issue raised: https://github.com/Microsoft/azure-pipelines-image-generation/issues/798

Let me know if you need more help.
Thanks!

All 4 comments

I have the same issue. Running on Linux in dotnet core 2.1 project

From my Azure-Pipelines.yaml

pool:
  vmImage: 'Ubuntu-16.04'

# Run unit tests
- task: DotNetCoreCLI@2
  displayName: 'Running unit tests'
  inputs:
    command: test
    projects: '**/*Tests/*.csproj'
    arguments: '--configuration $(buildConfiguration) --logger "trx;LogFileName=testresults.trx"'

# Run code coverage
- task: DotNetCoreCLI@2
  displayName: 'Running code coverage'
  inputs: 
    command: test
    projects: '**/*Tests/*.csproj'
    arguments: '--configuration $(buildConfiguration) /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:CoverletOutput=$(System.DefaultWorkingDirectory)/TestResults/Coverage/'

# Create report
- task: DotNetCoreCLI@2
  displayName: "Generating code coverage Reports"
  inputs:
    projects: '**/*Tests/*.csproj'
    command: custom
    custom: reportgenerator
    arguments: "-reports:$(System.DefaultWorkingDirectory)/TestResults/Coverage/*.xml -targetdir:results -reporttypes:HTMLInline;HTMLChart"

In my .csproj for the test-project, I have:

<ItemGroup>
    <DotNetCliToolReference Include="dotnet-reportgenerator-cli" Version="4.0.15" />

Same here. Even when I try installing the tool manually:

  - task: DotNetCoreCLI@2
    displayName: Install ReportGenerator Global Tool
    inputs:
      command: custom
      custom: tool
      arguments: install dotnet-reportgenerator-globaltool --version 4.0.15 --tool-path .

@jilpansi @ThomasBDO

You need to do dotnet restore, for dotnet-reportgenerator-cli to work. You can do it by repeating the DotNetCoreCLI task, with 'restore' as command, and point to the correct csproj.

@RTodorov

You can install the tool globally, by

  - task: DotNetCoreCLI@2
    displayName: Install ReportGenerator Global Tool
    inputs:
      command: custom
      custom: tool
      arguments: install dotnet-reportgenerator-globaltool -g

And then add a CommandLine script to the pipeline, to execute

reportgenerator <Arguments>

If you're installing the tool locally, you need to reference it by ./
eg:) ./reportgenerator

Issue with Linux:
We found a bug in Linux agent, where the PATH is not updating after global installation of dotnet tools. To workaround this, you need to add another CommandLine script before calling reportgenerator:

echo "##vso[task.prependpath]$HOME/.dotnet/tools"

Please note it needs to be a seperate task, before reportgenerator is used
Issue raised: https://github.com/Microsoft/azure-pipelines-image-generation/issues/798

Let me know if you need more help.
Thanks!

@ThomasBDO @jilpansi @RTodorov - I assume your issues are resolved using @issacnitin's suggestions above. Let us know if you still face the issue.

Was this page helpful?
0 / 5 - 0 ratings