0

I'm trying to run a "dotnet tool install" to install cli tool on the build agent in my pipeline and the behavior is inconsistent. Sometimes it executes the command successfully but it also fails sometimes with below error and I cannot figure out why however the same step executes successfully when i use azure default pipeline instead of YAML based.

error NU1212: Invalid project-package combination for project 1.0.0. DotnetToolReference project style can only contain references of the DotnetTool type  The tool package could not be restored. Tool 'project' failed to install. This failure may have been caused by:

* You are attempting to install a preview release and did not use the --version option to specify the version.
* A package by this name was found, but it was not a .NET Core tool.
* The required NuGet feed cannot be accessed, perhaps because of an Internet connection problem.
* You mistyped the name of the tool.

Here is the task:

- task: DotNetCoreCLI@2
  displayName: 'Install project'
  inputs:
    command: custom
    custom: tool
    arguments: 'install -g --version 1.0.0 --add-source https://sample.jfrog.io/artifactory/project project'

Command:

dotnet tool install -g --version 1.0.0 --add-source https://sample.jfrog.io/artifactory/project project

These tasks are running on Windows-latest image on Microsoft Hosted agents

Ia1
  • 500
  • 1
  • 7
  • 15
  • 1
    Could not reproduce this issue on my side. And since you cannot reproduce this problem stably, we can only perform troubleshoting at present. Please check the task version for the YAML and Classic pipeline? And use the same agent, your private agent to test and check the result. – Leo Liu Feb 09 '21 at 06:28
  • @LeoLiu-MSFT You mean this? If yes, both YAML and Classic pipeline uses the same version and also i made sure to use the same image and agent.OS to avoid the incompatibility issues. - task: DotNetCoreCLI@2 – Ia1 Feb 09 '21 at 16:27

0 Answers0