Azure DevOps - cannot run installed dotnet tool

0 votes

I tried to run the dotnet tool installed in Azure DevOps and test the tool.

Locally

dotnet tool install dotnetsay -g
dotnetsay test

It works seamlessly without any problem.

When I run this script in Azure DevOps.

  - task: CmdLine@2
    displayName: 'Install dotnetsay'
    inputs:
      script: 'dotnet tool install dotnetsay -g'

  - task: CmdLine@2
    displayName: 'Run dotnetsay'
    inputs:
      script: 'dotnetsay test'

It returns this error.

/home/vsts/work/_temp/8a35f36d-4eff-4541-9aae-cf3f063f9180.sh: line 1: dotnetsay: command not found
##[error]Bash exited with code '127'.

I've tried 3 different tools:

all of them gave the same result 

Is there any additional command to make the dotnet tool available for Azure DevOps?

Mar 27, 2022 in Other DevOps Questions by Kichu
• 19,040 points
602 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes
Add an initial UseDotNet task to set up the .NET SDK. This makes it clear which version you are expecting and ensures that you're building with that version.

The code:
- task: UseDotNet@2
  enabled: true
  inputs:
    packageType: 'sdk'
    version: 3.x

The dotnet tool dotnetsay first checks to see if the input is redirected. If it is, it reads input from the console. The input and output for the Azure DevOps pipeline agent are redirected. Consequently, the task will block on this line awaiting input. You will need to either cancel the Job or wait for it to time out.
answered Mar 31, 2022 by narikkadan
• 63,600 points

edited Mar 5

Related Questions In Other DevOps Questions

0 votes
1 answer
0 votes
0 answers

Azure API Management devops resource kit - creator tool

To generate arm templates to use in ...READ MORE

Mar 18, 2022 in Other DevOps Questions by Kichu
• 19,040 points
766 views
0 votes
0 answers

Azure Devops - Test Run Managment : resuming in-progress test

I am trying to figure out how ...READ MORE

Apr 2, 2022 in Other DevOps Questions by Kichu
• 19,040 points
1,592 views
0 votes
0 answers
0 votes
0 answers
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP