azure-pipelines-tasks: [UseDotNet] Can't use previous dotnet version when later version is installed

Required Information

Entering this information will route you directly to the right team and expedite traction.

Question, Bug, or Feature?
Type: Bug

Enter Task Name: UseDotNet

Environment

  • Server - Azure DevOps Server (on-premise) 2019 version: Dev17.M153.1
  • Agent - Private:
    • If using private agent, provide the OS of the machine running the agent and the agent version: OS: Ubuntu 18.04 Agent version: 2.164.0

Issue Description

In my pipeline I use the UseDotNet task to install dotnet core sdk. After installing version 3.1.200 we found some issues, so we wanted to revert back to 3.1.101. However when running the pipeline again, version 3.1.200 is still being used.

Relevant part of the pipeline:

steps:
  - task: UseDotNet@2
    inputs:
      packageType: 'sdk'
      version: '3.1.101'

  - task: DotNetCoreCLI@2
    inputs:
      command: 'custom'
      custom: '--version'

Expected output of DotNetCoreCLI task: 3.1.101 Actual output of DotNetCoreCLI task: 3.1.200

Task logs

Debug output from UseDotNet tasks:

##[debug]Evaluating condition for step: 'UseDotNet'
##[debug]Evaluating: SucceededNode()
##[debug]Evaluating SucceededNode:
##[debug]=> True
##[debug]Result: True
##[section]Starting: UseDotNet
==============================================================================
Task         : Use dotnet
Description  : Acquires a specific version of the .NET Core SDK from the internet or the local cache and adds it to the PATH. Use this task to change the version of .NET Core used in subsequent tasks. Additionally provides proxy support.
Version      : 2.0.5
Author       : Microsoft Corporation
Help         : https://aka.ms/AA4xgy0
==============================================================================
##[debug]agent.TempDirectory=/workspace/_temp
##[debug]loading inputs and endpoints
##[debug]loading INPUT_PACKAGETYPE
##[debug]loading INPUT_VERSION
##[debug]loading INPUT_INCLUDEPREVIEWVERSIONS
##[debug]loading INPUT_INSTALLATIONPATH
##[debug]loading INPUT_PERFORMMULTILEVELLOOKUP
##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
##[debug]loading SECRET_SYSTEM_ACCESSTOKEN
##[debug]loading SECRET_SPECSYNCPATTOKEN
##[debug]loaded 10
##[debug]Agent.ProxyUrl=undefined
##[debug]Agent.CAInfo=undefined
##[debug]Agent.ClientCert=undefined
##[debug]Agent.SkipCertValidation=undefined
##[debug]Agent.ProxyUrl=undefined
##[debug]Agent.CAInfo=undefined
##[debug]Agent.ClientCert=undefined
##[debug]check path : /workspace/_tasks/UseDotNet_b0ce7256-7898-45d3-9cb5-176b752bfea6/2.0.5/node_modules/azure-pipelines-tool-lib/lib.json
##[debug]adding resource file: /workspace/_tasks/UseDotNet_b0ce7256-7898-45d3-9cb5-176b752bfea6/2.0.5/node_modules/azure-pipelines-tool-lib/lib.json
##[debug]system.culture=en-US
##[debug]Agent.ProxyUrl=undefined
##[debug]Agent.CAInfo=undefined
##[debug]Agent.ClientCert=undefined
##[debug]check path : /workspace/_tasks/UseDotNet_b0ce7256-7898-45d3-9cb5-176b752bfea6/2.0.5/node_modules/packaging-common/node_modules/azure-pipelines-tool-lib/lib.json
##[debug]adding resource file: /workspace/_tasks/UseDotNet_b0ce7256-7898-45d3-9cb5-176b752bfea6/2.0.5/node_modules/packaging-common/node_modules/azure-pipelines-tool-lib/lib.json
##[debug]system.culture=en-US
##[debug]Setting resource path to /workspace/_tasks/UseDotNet_b0ce7256-7898-45d3-9cb5-176b752bfea6/2.0.5/task.json
##[debug]check path : /workspace/_tasks/UseDotNet_b0ce7256-7898-45d3-9cb5-176b752bfea6/2.0.5/task.json
##[debug]adding resource file: /workspace/_tasks/UseDotNet_b0ce7256-7898-45d3-9cb5-176b752bfea6/2.0.5/task.json
##[debug]system.culture=en-US
##[debug]check path : /workspace/_tasks/UseDotNet_b0ce7256-7898-45d3-9cb5-176b752bfea6/2.0.5/node_modules/packaging-common/module.json
##[debug]adding resource file: /workspace/_tasks/UseDotNet_b0ce7256-7898-45d3-9cb5-176b752bfea6/2.0.5/node_modules/packaging-common/module.json
##[debug]system.culture=en-US
##[debug]packageType=sdk
##[debug]version=3.1.101
Tool to install: .NET Core sdk version 3.1.101.
##[debug]installationPath=/workspace/_tool/dotnet
##[debug]includePreviewVersions=false
##[debug]agent.proxyurl=undefined
##[debug]AZURE_HTTP_USER_AGENT=TFS_6179c51a-69b7-40d9-a6f6-5caceb310a66_build_441_0
##[debug]Finding channel 3.1 for version 3.1.101
##[debug]In release undefined for version 3.1.100, File data is incorrect (might have missing required fields, such as name, rid and url): Version's files data is missing or has missing required fields.
##[debug]In release undefined for version 3.1.100, File data is incorrect (might have missing required fields, such as name, rid and url): Version's files data is missing or has missing required fields.
##[debug]In release undefined for version 3.1.100-preview3-014645, File data is incorrect (might have missing required fields, such as name, rid and url): Version's files data is missing or has missing required fields.
##[debug]In release undefined for version 3.1.100-preview3-014645, File data is incorrect (might have missing required fields, such as name, rid and url): Version's files data is missing or has missing required fields.
##[debug]In release undefined for version 3.1.100-preview2-014569, File data is incorrect (might have missing required fields, such as name, rid and url): Version's files data is missing or has missing required fields.
##[debug]In release undefined for version 3.1.100-preview2-014569, File data is incorrect (might have missing required fields, such as name, rid and url): Version's files data is missing or has missing required fields.
##[debug]In release undefined for version 3.1.100-preview1-014459, File data is incorrect (might have missing required fields, such as name, rid and url): Version's files data is missing or has missing required fields.
##[debug]In release undefined for version 3.1.100-preview1-014459, File data is incorrect (might have missing required fields, such as name, rid and url): Version's files data is missing or has missing required fields.
Found version 3.1.101 in channel 3.1 for user specified version spec: 3.1.101
##[debug]Processed: ##vso[telemetry.publish area=TaskDeploymentMethod;feature=UseDotNetV2]{"userVersion":"3.1.101", "resolvedVersion":"3.1.101"}
##[debug]isExplicit: 3.1.101
##[debug]explicit? true
Version 3.1.101 was not found in cache.
Getting URL to download .NET Core sdk version: 3.1.101.
Detecting OS platform to find correct download package for the OS.
##[debug]which '/workspace/_tasks/UseDotNet_b0ce7256-7898-45d3-9cb5-176b752bfea6/2.0.5/externals/get-os-distro.sh'
##[debug]found: '/workspace/_tasks/UseDotNet_b0ce7256-7898-45d3-9cb5-176b752bfea6/2.0.5/externals/get-os-distro.sh'
##[debug]which '/workspace/_tasks/UseDotNet_b0ce7256-7898-45d3-9cb5-176b752bfea6/2.0.5/externals/get-os-distro.sh'
##[debug]found: '/workspace/_tasks/UseDotNet_b0ce7256-7898-45d3-9cb5-176b752bfea6/2.0.5/externals/get-os-distro.sh'
##[debug]which '/workspace/_tasks/UseDotNet_b0ce7256-7898-45d3-9cb5-176b752bfea6/2.0.5/externals/get-os-distro.sh'
##[debug]found: '/workspace/_tasks/UseDotNet_b0ce7256-7898-45d3-9cb5-176b752bfea6/2.0.5/externals/get-os-distro.sh'
##[debug]which '/workspace/_tasks/UseDotNet_b0ce7256-7898-45d3-9cb5-176b752bfea6/2.0.5/externals/get-os-distro.sh'
##[debug]found: '/workspace/_tasks/UseDotNet_b0ce7256-7898-45d3-9cb5-176b752bfea6/2.0.5/externals/get-os-distro.sh'
##[debug]exec tool: /workspace/_tasks/UseDotNet_b0ce7256-7898-45d3-9cb5-176b752bfea6/2.0.5/externals/get-os-distro.sh
##[debug]arguments:
[command]/workspace/_tasks/UseDotNet_b0ce7256-7898-45d3-9cb5-176b752bfea6/2.0.5/externals/get-os-distro.sh
Primary:linux-x64
Legacy:ubuntu.18.04-x64
Detected platform (Primary): linux-x64
Detected platform (Legacy): ubuntu.18.04-x64
##[debug]Got download URL for platform with rid: linux-x64
##[debug]
##[debug]Agent.Version=2.164.0
##[debug]Agent.TempDirectory=/workspace/_temp
##[debug]testing directory '/workspace/_temp'
Downloading: https://download.visualstudio.microsoft.com/download/pr/c4b503d6-2f41-4908-b634-270a0a1dcfca/c5a20e42868a48a2cd1ae27cf038044c/dotnet-sdk-3.1.101-linux-x64.tar.gz
##[debug]destination /workspace/_temp/9acab4c3-9d91-4f95-853a-fcce960ee57a
##[debug]downloading
##[debug]creating stream
##[debug]download complete
Extracting downloaded package /workspace/_temp/9acab4c3-9d91-4f95-853a-fcce960ee57a.
Extracting archive
##[debug]Agent.Version=2.164.0
##[debug]Agent.TempDirectory=/workspace/_temp
##[debug]testing directory '/workspace/_temp/ba6cc3b1-fbb9-4bc4-9841-20c98ef1b191'
##[debug]testing directory '/workspace/_temp'
##[debug]mkdir '/workspace/_temp/ba6cc3b1-fbb9-4bc4-9841-20c98ef1b191'
##[debug]which 'tar'
##[debug]found: '/bin/tar'
##[debug]which 'tar'
##[debug]found: '/bin/tar'
##[debug]/bin/tar arg: ["xzC","/workspace/_temp/ba6cc3b1-fbb9-4bc4-9841-20c98ef1b191","-f","/workspace/_temp/9acab4c3-9d91-4f95-853a-fcce960ee57a"]
##[debug]exec tool: /bin/tar
##[debug]arguments:
##[debug]   xzC
##[debug]   /workspace/_temp/ba6cc3b1-fbb9-4bc4-9841-20c98ef1b191
##[debug]   -f
##[debug]   /workspace/_temp/9acab4c3-9d91-4f95-853a-fcce960ee57a
[command]/bin/tar xzC /workspace/_temp/ba6cc3b1-fbb9-4bc4-9841-20c98ef1b191 -f /workspace/_temp/9acab4c3-9d91-4f95-853a-fcce960ee57a
##[debug]Exit code 0 received from tool '/bin/tar'
##[debug]STDIO streams have closed for tool '/bin/tar'
##[debug]Copying all root folders into installation path: /workspace/_tool/dotnet
##[debug]Comparing if version being installed 3.1.101 is greater than already installed version with folder name 3.1.101
##[debug]isExplicit: 3.1.101
##[debug]explicit? true
##[debug]isExplicit: 3.1.101
##[debug]explicit? true
##[debug]Comparing if version being installed 3.1.101 is greater than already installed version with folder name 3.1.102
##[debug]isExplicit: 3.1.102
##[debug]explicit? true
##[debug]isExplicit: 3.1.101
##[debug]explicit? true
##[debug]Version: 3.1.101 is not the latest among the versions present at /workspace/_tool/dotnet
##[debug]Creating installation complete file for .Net core 3.1.101 version sdk
Successfully installed .NET Core sdk version 3.1.101.
##[debug]Agent.Version=2.164.0
##[debug]Processed: ##vso[task.prependpath]/workspace/_tool/dotnet
##[debug]set DOTNET_ROOT=/workspace/_tool/dotnet
##[debug]Processed: ##vso[task.setvariable variable=DOTNET_ROOT;issecret=false;]/workspace/_tool/dotnet
##[debug]performMultiLevelLookup=false
##[debug]set DOTNET_MULTILEVEL_LOOKUP=0
##[debug]Processed: ##vso[task.setvariable variable=DOTNET_MULTILEVEL_LOOKUP;issecret=false;]0
##[debug]nugetVersion=undefined
##[debug]Agent.ProxyUrl=undefined
Creating global tool path and pre-pending to PATH.
##[debug]testing directory '/root/.dotnet/tools'
##[debug]Agent.Version=2.164.0
##[debug]Processed: ##vso[task.prependpath]/root/.dotnet/tools
##[debug]task result: Succeeded
##[debug]Processed: ##vso[task.complete result=Succeeded;]
##[section]Finishing: UseDotNet

Debug output from DotNetCoreCLI tasks:

##[debug]Evaluating condition for step: 'DotNetCoreCLI'
##[debug]Evaluating: SucceededNode()
##[debug]Evaluating SucceededNode:
##[debug]=> True
##[debug]Result: True
##[section]Starting: DotNetCoreCLI
==============================================================================
Task         : .NET Core
Description  : Build, test, package, or publish a dotnet application, or run a custom dotnet command
Version      : 2.153.0
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/dotnet-core-cli
==============================================================================
##[debug]agent.TempDirectory=/workspace/_temp
##[debug]loading inputs and endpoints
##[debug]loading INPUT_COMMAND
##[debug]loading INPUT_PUBLISHWEBPROJECTS
##[debug]loading INPUT_CUSTOM
##[debug]loading INPUT_PUBLISHTESTRESULTS
##[debug]loading INPUT_ZIPAFTERPUBLISH
##[debug]loading INPUT_MODIFYOUTPUTPATH
##[debug]loading INPUT_SELECTORCONFIG
##[debug]loading INPUT_INCLUDENUGETORG
##[debug]loading INPUT_NUGETCONFIGPATH
##[debug]loading INPUT_NOCACHE
##[debug]loading INPUT_VERBOSITYRESTORE
##[debug]loading INPUT_SEARCHPATTERNPUSH
##[debug]loading INPUT_NUGETFEEDTYPE
##[debug]loading INPUT_PUBLISHPACKAGEMETADATA
##[debug]loading INPUT_SEARCHPATTERNPACK
##[debug]loading INPUT_CONFIGURATIONTOPACK
##[debug]loading INPUT_OUTPUTDIR
##[debug]loading INPUT_NOBUILD
##[debug]loading INPUT_INCLUDESYMBOLS
##[debug]loading INPUT_INCLUDESOURCE
##[debug]loading INPUT_VERSIONINGSCHEME
##[debug]loading INPUT_REQUESTEDMAJORVERSION
##[debug]loading INPUT_REQUESTEDMINORVERSION
##[debug]loading INPUT_REQUESTEDPATCHVERSION
##[debug]loading INPUT_VERBOSITYPACK
##[debug]loading INPUT_WORKINGDIRECTORY
##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
##[debug]loading SECRET_SYSTEM_ACCESSTOKEN
##[debug]loading SECRET_SPECSYNCPATTOKEN
##[debug]loaded 31
##[debug]Agent.ProxyUrl=undefined
##[debug]Agent.CAInfo=undefined
##[debug]Agent.ClientCert=undefined
##[debug]Agent.SkipCertValidation=undefined
##[debug]command=custom
##[debug]projects=null
##[debug]arguments=null
##[debug]publishWebProjects=true
##[debug]zipAfterPublish=true
##[debug]workingDirectory=/workspace/8/s
##[debug]check path : /workspace/_tasks/DotNetCoreCLI_5541a522-603c-47ad-91fc-a4b1d163081b/2.153.0/task.json
##[debug]adding resource file: /workspace/_tasks/DotNetCoreCLI_5541a522-603c-47ad-91fc-a4b1d163081b/2.153.0/task.json
##[debug]system.culture=en-US
##[debug]custom=--version
##[debug]which 'dotnet'
##[debug]found: '/workspace/_tool/dotnet/dotnet'
##[debug]which 'dotnet'
##[debug]found: '/workspace/_tool/dotnet/dotnet'
##[debug]which '/workspace/_tool/dotnet/dotnet'
##[debug]found: '/workspace/_tool/dotnet/dotnet'
##[debug]which '/workspace/_tool/dotnet/dotnet'
##[debug]found: '/workspace/_tool/dotnet/dotnet'
##[debug]/workspace/_tool/dotnet/dotnet arg: --version
##[debug]exec tool: /workspace/_tool/dotnet/dotnet
##[debug]arguments:
##[debug]   --version
[command]/workspace/_tool/dotnet/dotnet --version
3.1.200
##[debug]Exit code 0 received from tool '/workspace/_tool/dotnet/dotnet'
##[debug]STDIO streams have closed for tool '/workspace/_tool/dotnet/dotnet'
##[section]Finishing: DotNetCoreCLI

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 2
  • Comments: 26 (12 by maintainers)

Most upvoted comments

Why has this been closed?

The “Use .NET Core” task specifically states: “Acquires a specific version of the .NET Core SDK from the internet or the local cache and adds it to the PATH. Use this task to change the version of .NET Core used in subsequent tasks. Additionally provides proxy support.”

The actual functionality appears not to be this at all? It appears to install the requested version, but actually use the latest version that’s installed. Clearly that is not correct.

Using a global.json is a nasty workaround to a problem that doesn’t need to exist.

Anything new about this issue?

We’re experiencing this issue after a project installed Dotnet 8 rc-2 and the other projects (running on the same Agent) fails, because they are switched to Dotnet 8, even though we specify Dotnet 6 in the yaml file. 😕

I think this task should be re-opened. We’re seeing the same behaviour as well. @vinodkumar3