Feature Request - docs - Add instructions to get this working in Azure DevOps #84

Open
opened 2026-01-29 16:28:56 +00:00 by claunia · 2 comments
Owner

Originally created by @alexmarshall132 on GitHub (Jul 28, 2020).

Using the current instructions for dotnet tool install does not work on Azure DevOps due to an unknown error. Can you please provide instructions that will work for using this tool with Azure DevOps pipelines ?

Originally created by @alexmarshall132 on GitHub (Jul 28, 2020). Using the current instructions for `dotnet tool install` does not work on Azure DevOps due to an unknown error. Can you please provide instructions that will work for using this tool with Azure DevOps pipelines ?
Author
Owner

@joncloud commented on GitHub (Sep 2, 2020):

I was able to get the tool to work in Azure DevOps by using the following script block (on ubuntu-latest):

dotnet tool install --global dotnet-zip
export PATH=$PATH:~/.dotnet/tools
dotnet zip --configuration $(buildConfiguration)

I think the core problem is that by default the dotnet tools path is not included on the image, and does not have to do with this tool itself. I found microsoft/azure-pipelines-task #12548, which is a similar problem with a different tool. I ran a test based on the issue's feedback, and it was also successful. For example see the following steps in the pipeline:

- task: UseDotNet@2
  inputs:
    packageType: 'sdk'
    version: '3.1.x'
  displayName: 'use .net 3.1.x'

- script: |
    dotnet tool install --global dotnet-zip
    dotnet zip --configuration $(buildConfiguration)
  displayName: 'dotnet zip $(buildConfiguration)'
@joncloud commented on GitHub (Sep 2, 2020): I was able to get the tool to work in Azure DevOps by using the following script block (on `ubuntu-latest`): ```bash dotnet tool install --global dotnet-zip export PATH=$PATH:~/.dotnet/tools dotnet zip --configuration $(buildConfiguration) ``` I think the core problem is that by default the dotnet tools path is not included on the image, and does not have to do with this tool itself. I found [microsoft/azure-pipelines-task #12548](https://github.com/microsoft/azure-pipelines-tasks/issues/12548), which is a similar problem with a different tool. I ran a test based on the issue's feedback, and it was also successful. For example see the following steps in the pipeline: ```yaml - task: UseDotNet@2 inputs: packageType: 'sdk' version: '3.1.x' displayName: 'use .net 3.1.x' - script: | dotnet tool install --global dotnet-zip dotnet zip --configuration $(buildConfiguration) displayName: 'dotnet zip $(buildConfiguration)' ```
Author
Owner

@alexmarshall132 commented on GitHub (Sep 3, 2020):

Thank you for responding @joncloud . Unfortunately for whatever reason doing a global install always fails for my organization's build machine images. After a lot of experimenting, I found that I had to create a tool manifest for my projects and then do a local tool install for the project. Here's what worked for me:


- task: DotNetCoreCLI@2
  displayName: 'Restore dotnet tools for various build tasks'
  inputs:
    command: 'custom'
    custom: 'tool'
    arguments: 'restore --tool-manifest "$(Build.SourcesDirectory)/dotnet-tools.json" --configfile "$(Build.SourcesDirectory)/nuget.config"'


- task: DotNetCoreCLI@2
  displayName: 'Run .deb packaging tool for linux-arm64'
  inputs:
    command: 'custom'
    custom: 'tool'
    arguments: 'run dotnet-deb -c Release -f netcoreapp3.1 -r linux-arm64'
    workingDirectory: '$(Build.SourcesDirectory)/MyProjectName'
@alexmarshall132 commented on GitHub (Sep 3, 2020): Thank you for responding @joncloud . Unfortunately for whatever reason doing a global install always fails for my organization's build machine images. After a lot of experimenting, I found that I had to create a tool manifest for my projects and then do a local tool install for the project. Here's what worked for me: ``` - task: DotNetCoreCLI@2 displayName: 'Restore dotnet tools for various build tasks' inputs: command: 'custom' custom: 'tool' arguments: 'restore --tool-manifest "$(Build.SourcesDirectory)/dotnet-tools.json" --configfile "$(Build.SourcesDirectory)/nuget.config"' - task: DotNetCoreCLI@2 displayName: 'Run .deb packaging tool for linux-arm64' inputs: command: 'custom' custom: 'tool' arguments: 'run dotnet-deb -c Release -f netcoreapp3.1 -r linux-arm64' workingDirectory: '$(Build.SourcesDirectory)/MyProjectName' ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/dotnet-packaging#84