After calling UseDotNet@2 task, the new .NET SDK location is changed from /usr/share/dotnet/sdk to /opt/hostedtoolcache/dotnet making pre-installed SDKs no longer available.
Environment type (Please select at least one enviroment where you face this issue)
[ ] Self-Hosted
[x] Microsoft Hosted
[ ] VMSS Pool
[ ] Container
Azure DevOps Server type
dev.azure.com (formerly visualstudio.com)
Azure DevOps Server Version (if applicable)
No response
Operation system
Ubuntu-latest
Relevant log output
==============================================================================
Task : Command line
Description : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows
Version : 2.246.1
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/command-line
==============================================================================
Generating script.
Script contents:
dotnet --list-sdks
========================== Starting Command Output ===========================
/usr/bin/bash --noprofile --norc /home/vsts/work/_temp/d61b811b-3c32-45f7-a1aa-7b749318790c.sh
6.0.428 [/usr/share/dotnet/sdk]
7.0.410 [/usr/share/dotnet/sdk]
8.0.404 [/usr/share/dotnet/sdk]
==============================================================================
Task : Use .NET Core
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.247.1
Author : Microsoft Corporation
Help : https://aka.ms/AA4xgy0
==============================================================================
Tool to install: .NET Core sdk version 9.x.
Found version 9.0.100 in channel 9.0 for user specified version spec: 9.x
get-os-distro: Error: Distribution specific OS name and version could not be detected: UName = Linux
Version 9.0.100 was not found in cache.
Getting URL to download .NET Core sdk version: 9.0.100.
Detecting OS platform to find correct download package for the OS.
/home/vsts/work/_tasks/UseDotNet_b0ce7256-7898-45d3-9cb5-176b752bfea6/2.247.1/externals/get-os-distro.sh
Primary:linux-x64
Legacy:-x64
Detected platform (Primary): linux-x64
Detected platform (Legacy): -x64
Downloading: https://download.visualstudio.microsoft.com/download/pr/308f16a9-2ecf-4a42-b8bb-c1233de985fd/be6e87045ab21935bd8bb98ce69026c4/dotnet-sdk-9.0.100-linux-x64.tar.gz
Extracting downloaded package /home/vsts/work/_temp/3912f39d-d1b0-4a7f-96bb-ba9d17e73363.
Extracting archive
/usr/bin/tar xC /home/vsts/work/_temp/55dd1e2e-221b-4e2f-9f41-ab6ca702a389 -f /home/vsts/work/_temp/3912f39d-d1b0-4a7f-96bb-ba9d17e73363
Successfully installed .NET Core sdk version 9.0.100.
Creating global tool path and pre-pending to PATH.
Finishing: UseDotNet
==============================================================================
Task : Command line
Description : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows
Version : 2.246.1
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/command-line
==============================================================================
Generating script.
Script contents:
dotnet --list-sdks
========================== Starting Command Output ===========================
/usr/bin/bash --noprofile --norc /home/vsts/work/_temp/9d5e4529-9d60-45c0-965e-920f0088469d.sh
9.0.100 [/opt/hostedtoolcache/dotnet/sdk]
Finishing: CmdLine
Full task logs with system.debug enabled
2024-11-15T20:57:42.2849193Z ##[debug]Evaluating condition for step: 'UseDotNet'
2024-11-15T20:57:42.2850163Z ##[debug]Evaluating: SucceededNode()
2024-11-15T20:57:42.2850547Z ##[debug]Evaluating SucceededNode:
2024-11-15T20:57:42.2851102Z ##[debug]=> True
2024-11-15T20:57:42.2851509Z ##[debug]Result: True
2024-11-15T20:57:42.2851889Z ##[section]Starting: UseDotNet
2024-11-15T20:57:42.2859969Z ==============================================================================
2024-11-15T20:57:42.2860162Z Task : Use .NET Core
2024-11-15T20:57:42.2860290Z 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.
2024-11-15T20:57:42.2860605Z Version : 2.247.1
2024-11-15T20:57:42.2860705Z Author : Microsoft Corporation
2024-11-15T20:57:42.2860835Z Help : https://aka.ms/AA4xgy0
2024-11-15T20:57:42.2860945Z ==============================================================================
2024-11-15T20:57:42.3826067Z ##[debug]Using node path: /home/vsts/agents/3.246.0/externals/node20_1/bin/node
2024-11-15T20:57:42.4701804Z ##[debug]system.debug=True
2024-11-15T20:57:42.4702636Z ##[debug]DistributedTask.Tasks.Node.SkipDebugLogsWhenDebugModeOff=True
2024-11-15T20:57:42.4780504Z ##[debug]agent.TempDirectory=/home/vsts/work/_temp
2024-11-15T20:57:42.4781535Z ##[debug]loading inputs and endpoints
2024-11-15T20:57:42.4782288Z ##[debug]loading INPUT_PACKAGETYPE
2024-11-15T20:57:42.4782999Z ##[debug]loading INPUT_USEGLOBALJSON
2024-11-15T20:57:42.4783779Z ##[debug]loading INPUT_WORKINGDIRECTORY
2024-11-15T20:57:42.4786493Z ##[debug]loading INPUT_VERSION
2024-11-15T20:57:42.4787234Z ##[debug]loading INPUT_INCLUDEPREVIEWVERSIONS
2024-11-15T20:57:42.4981678Z ##[debug]loading INPUT_INSTALLATIONPATH
2024-11-15T20:57:42.5039466Z ##[debug]loading INPUT_PERFORMMULTILEVELLOOKUP
2024-11-15T20:57:42.5040395Z ##[debug]loading INPUT_REQUESTTIMEOUT
2024-11-15T20:57:42.5041181Z ##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
2024-11-15T20:57:42.5042338Z ##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
2024-11-15T20:57:42.5043332Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
2024-11-15T20:57:42.5044111Z ##[debug]loading SECRET_SYSTEM_ACCESSTOKEN
2024-11-15T20:57:42.5044821Z ##[debug]loaded 12
2024-11-15T20:57:42.5045510Z ##[debug]Agent.ProxyUrl=undefined
2024-11-15T20:57:42.5046218Z ##[debug]Agent.CAInfo=undefined
2024-11-15T20:57:42.5047080Z ##[debug]Agent.ClientCert=undefined
2024-11-15T20:57:42.5047861Z ##[debug]Agent.SkipCertValidation=undefined
2024-11-15T20:57:42.5430032Z ##[debug]Agent.ProxyUrl=undefined
2024-11-15T20:57:42.5432082Z ##[debug]Agent.CAInfo=undefined
2024-11-15T20:57:42.5433081Z ##[debug]Agent.ClientCert=undefined
2024-11-15T20:57:42.5435452Z ##[debug]check path : /home/vsts/work/_tasks/UseDotNet_b0ce7256-7898-45d3-9cb5-176b752bfea6/2.247.1/node_modules/azure-pipelines-tool-lib/lib.json
2024-11-15T20:57:42.5439886Z ##[debug]adding resource file: /home/vsts/work/_tasks/UseDotNet_b0ce7256-7898-45d3-9cb5-176b752bfea6/2.247.1/node_modules/azure-pipelines-tool-lib/lib.json
2024-11-15T20:57:42.5440949Z ##[debug]system.culture=en-US
2024-11-15T20:57:42.5458378Z ##[debug]Set default DNS lookup order to ipv4 first
2024-11-15T20:57:42.5459315Z ##[debug]Set default auto select family to false
2024-11-15T20:57:42.5606184Z ##[debug]Setting resource path to /home/vsts/work/_tasks/UseDotNet_b0ce7256-7898-45d3-9cb5-176b752bfea6/2.247.1/task.json
2024-11-15T20:57:42.5608193Z ##[debug]check path : /home/vsts/work/_tasks/UseDotNet_b0ce7256-7898-45d3-9cb5-176b752bfea6/2.247.1/task.json
2024-11-15T20:57:42.5609901Z ##[debug]adding resource file: /home/vsts/work/_tasks/UseDotNet_b0ce7256-7898-45d3-9cb5-176b752bfea6/2.247.1/task.json
2024-11-15T20:57:42.5610853Z ##[debug]system.culture=en-US
2024-11-15T20:57:42.5619178Z ##[debug]check path : /home/vsts/work/_tasks/UseDotNet_b0ce7256-7898-45d3-9cb5-176b752bfea6/2.247.1/node_modules/azure-pipelines-tasks-packaging-common/module.json
2024-11-15T20:57:42.5621110Z ##[debug]adding resource file: /home/vsts/work/_tasks/UseDotNet_b0ce7256-7898-45d3-9cb5-176b752bfea6/2.247.1/node_modules/azure-pipelines-tasks-packaging-common/module.json
2024-11-15T20:57:42.5622840Z ##[debug]system.culture=en-US
2024-11-15T20:57:42.5665480Z ##[debug]useGlobalJson=false
2024-11-15T20:57:42.5666062Z ##[debug]packageType=sdk
2024-11-15T20:57:42.5666608Z ##[debug]version=9.x
2024-11-15T20:57:42.5667165Z ##[debug]vsVersion=undefined
2024-11-15T20:57:42.5667719Z ##[debug]nugetVersion=undefined
2024-11-15T20:57:42.5668296Z ##[debug]installationPath=/opt/hostedtoolcache/dotnet
2024-11-15T20:57:42.5668881Z ##[debug]performMultiLevelLookup=false
2024-11-15T20:57:42.5669432Z ##[debug]includePreviewVersions=false
2024-11-15T20:57:42.5671110Z ##[debug]workingDirectory=/home/vsts/work/1/s
2024-11-15T20:57:42.5671623Z ##[debug]agent.proxyurl=undefined
2024-11-15T20:57:42.5674566Z ##[debug]requestTimeout=300000
2024-11-15T20:57:42.5675207Z ##[debug]AZURE_HTTP_USER_AGENT=VSTS_29071db2-8831-4cbd-8c3c-5dbb670a2ca1_build_1788_0
2024-11-15T20:57:42.5681269Z ##[debug]testing directory '/opt/hostedtoolcache/dotnet'
2024-11-15T20:57:42.5682332Z ##[debug]testing directory '/opt/hostedtoolcache'
2024-11-15T20:57:42.5684847Z ##[debug]mkdir '/opt/hostedtoolcache/dotnet'
2024-11-15T20:57:42.5700653Z Tool to install: .NET Core sdk version 9.x.
2024-11-15T20:57:43.1727348Z ##[debug]Finding channel 9.0 for version 9.x
2024-11-15T20:57:43.1754028Z ##[debug]Agent environment resources - Disk: / Available 20155.62 MB out of 74244.74 MB, Memory: Used 969.00 MB out of 6921.00 MB, CPU: Usage 57.91%
2024-11-15T20:57:44.4736141Z Found version 9.0.100 in channel 9.0 for user specified version spec: 9.x
2024-11-15T20:57:44.5102670Z ##[debug]Processed: ##vso[telemetry.publish area=TaskDeploymentMethod;feature=UseDotNetV2]{"userVersion":"9.x", "resolvedVersion":"9.0.100"}
2024-11-15T20:57:44.5104214Z get-os-distro: Error: Distribution specific OS name and version could not be detected: UName = Linux
2024-11-15T20:57:44.5105169Z ##[debug]isExplicit: 9.0.100
2024-11-15T20:57:44.5105743Z ##[debug]explicit? true
2024-11-15T20:57:44.5106091Z Version 9.0.100 was not found in cache.
2024-11-15T20:57:44.5106419Z Getting URL to download .NET Core sdk version: 9.0.100.
2024-11-15T20:57:44.5106752Z Detecting OS platform to find correct download package for the OS.
2024-11-15T20:57:44.5107359Z ##[debug]which '/home/vsts/work/_tasks/UseDotNet_b0ce7256-7898-45d3-9cb5-176b752bfea6/2.247.1/externals/get-os-distro.sh'
2024-11-15T20:57:44.5108113Z ##[debug]found: '/home/vsts/work/_tasks/UseDotNet_b0ce7256-7898-45d3-9cb5-176b752bfea6/2.247.1/externals/get-os-distro.sh'
2024-11-15T20:57:44.5108825Z ##[debug]which '/home/vsts/work/_tasks/UseDotNet_b0ce7256-7898-45d3-9cb5-176b752bfea6/2.247.1/externals/get-os-distro.sh'
2024-11-15T20:57:44.5109556Z ##[debug]found: '/home/vsts/work/_tasks/UseDotNet_b0ce7256-7898-45d3-9cb5-176b752bfea6/2.247.1/externals/get-os-distro.sh'
2024-11-15T20:57:44.5110284Z ##[debug]exec tool: /home/vsts/work/_tasks/UseDotNet_b0ce7256-7898-45d3-9cb5-176b752bfea6/2.247.1/externals/get-os-distro.sh
2024-11-15T20:57:44.5110912Z ##[debug]arguments:
2024-11-15T20:57:44.5111604Z [command]/home/vsts/work/_tasks/UseDotNet_b0ce7256-7898-45d3-9cb5-176b752bfea6/2.247.1/externals/get-os-distro.sh
2024-11-15T20:57:44.5111977Z Primary:linux-x64
2024-11-15T20:57:44.5112237Z Legacy:-x64
2024-11-15T20:57:44.5112499Z Detected platform (Primary): linux-x64
2024-11-15T20:57:44.5113202Z Detected platform (Legacy): -x64
2024-11-15T20:57:44.5113725Z ##[debug]Got download URL for platform with rid: linux-x64
2024-11-15T20:57:44.5114274Z ##[debug]
2024-11-15T20:57:44.5114790Z ##[debug]Agent.Version=3.246.0
2024-11-15T20:57:44.5115340Z ##[debug]Agent.TempDirectory=/home/vsts/work/_temp
2024-11-15T20:57:44.5115921Z ##[debug]testing directory '/home/vsts/work/_temp'
2024-11-15T20:57:44.5116699Z Downloading: https://download.visualstudio.microsoft.com/download/pr/308f16a9-2ecf-4a42-b8bb-c1233de985fd/be6e87045ab21935bd8bb98ce69026c4/dotnet-sdk-9.0.100-linux-x64.tar.gz
2024-11-15T20:57:44.5117571Z ##[debug]destination /home/vsts/work/_temp/94ece9f8-501c-4f43-99bc-ef5dcd14ce89
2024-11-15T20:57:44.5118158Z ##[debug]downloading
2024-11-15T20:57:44.5810650Z ##[debug]Content-Length of downloaded file: 209148140
2024-11-15T20:57:44.5812378Z ##[debug]creating stream
2024-11-15T20:57:44.5931994Z ##[debug]file write stream opened. fd: 19
2024-11-15T20:57:44.5933207Z ##[debug]subscribing to message read stream events...
2024-11-15T20:57:44.5936978Z ##[debug]successfully subscribed to message read stream events
2024-11-15T20:57:46.8524123Z ##[debug]download complete
2024-11-15T20:57:46.8525468Z ##[debug]Downloaded file size: 209148140 bytes
2024-11-15T20:57:46.8526697Z Extracting downloaded package /home/vsts/work/_temp/94ece9f8-501c-4f43-99bc-ef5dcd14ce89.
2024-11-15T20:57:46.8527679Z ##[debug]Agent.TempDirectory=/home/vsts/work/_temp
2024-11-15T20:57:46.8528619Z Extracting archive
2024-11-15T20:57:46.8530094Z ##[debug]Agent.Version=3.246.0
2024-11-15T20:57:46.8530866Z ##[debug]Agent.TempDirectory=/home/vsts/work/_temp
2024-11-15T20:57:46.8531756Z ##[debug]testing directory '/home/vsts/work/_temp/7f8c60cb-c377-4895-9f8a-0d62150e4add'
2024-11-15T20:57:46.8532785Z ##[debug]testing directory '/home/vsts/work/_temp'
2024-11-15T20:57:46.8533660Z ##[debug]mkdir '/home/vsts/work/_temp/7f8c60cb-c377-4895-9f8a-0d62150e4add'
2024-11-15T20:57:46.8534587Z ##[debug]which 'tar'
2024-11-15T20:57:46.8538493Z ##[debug]found: '/usr/bin/tar'
2024-11-15T20:57:46.8539793Z ##[debug]/usr/bin/tar arg: ["xC","/home/vsts/work/_temp/7f8c60cb-c377-4895-9f8a-0d62150e4add","-f","/home/vsts/work/_temp/94ece9f8-501c-4f43-99bc-ef5dcd14ce89"]
2024-11-15T20:57:46.8542775Z ##[debug]exec tool: /usr/bin/tar
2024-11-15T20:57:46.8543501Z ##[debug]arguments:
2024-11-15T20:57:46.8544266Z ##[debug] xC
2024-11-15T20:57:46.8545708Z ##[debug] /home/vsts/work/_temp/7f8c60cb-c377-4895-9f8a-0d62150e4add
2024-11-15T20:57:46.8546347Z ##[debug] -f
2024-11-15T20:57:46.8546938Z ##[debug] /home/vsts/work/_temp/94ece9f8-501c-4f43-99bc-ef5dcd14ce89
2024-11-15T20:57:46.8547744Z [command]/usr/bin/tar xC /home/vsts/work/_temp/7f8c60cb-c377-4895-9f8a-0d62150e4add -f /home/vsts/work/_temp/94ece9f8-501c-4f43-99bc-ef5dcd14ce89
2024-11-15T20:57:49.2757184Z ##[debug]Agent environment resources - Disk: / Available 19818.63 MB out of 74244.74 MB, Memory: Used 1037.00 MB out of 6921.00 MB, CPU: Usage 61.68%
2024-11-15T20:57:52.3885344Z
2024-11-15T20:57:52.3897629Z ##[debug]Process exited with code 0 and signal null for tool '/usr/bin/tar'
2024-11-15T20:57:52.3898807Z ##[debug]STDIO streams have closed and received exit code 0 and signal null for tool '/usr/bin/tar'
2024-11-15T20:57:52.3906255Z ##[debug]Copying all root folders into installation path: /opt/hostedtoolcache/dotnet
2024-11-15T20:57:53.7533763Z ##[debug]Comparing if version being installed 9.0.100 is greater than already installed version with folder name 9.0.100
2024-11-15T20:57:53.7537022Z ##[debug]isExplicit: 9.0.100
2024-11-15T20:57:53.7539311Z ##[debug]explicit? true
2024-11-15T20:57:53.7542092Z ##[debug]isExplicit: 9.0.100
2024-11-15T20:57:53.7544275Z ##[debug]explicit? true
2024-11-15T20:57:53.7547969Z ##[debug]Version: 9.0.100 is the latest among the versions present at path: /opt/hostedtoolcache/dotnet
2024-11-15T20:57:53.7550300Z ##[debug]Copying root files (such as dotnet.exe) into installation path: /opt/hostedtoolcache/dotnet
2024-11-15T20:57:53.7574720Z ##[debug]Creating installation complete marker file for .Net core 9.0.100 version sdk
2024-11-15T20:57:53.7580425Z Successfully installed .NET Core sdk version 9.0.100.
2024-11-15T20:57:53.7586012Z ##[debug]Agent.Version=3.246.0
2024-11-15T20:57:53.7597541Z ##[debug]Processed: ##vso[task.prependpath]/opt/hostedtoolcache/dotnet
2024-11-15T20:57:53.7598348Z ##[debug]set DOTNET_ROOT=/opt/hostedtoolcache/dotnet
2024-11-15T20:57:53.7599281Z ##[debug]Processed: ##vso[task.setvariable variable=DOTNET_ROOT;isOutput=false;issecret=false;]/opt/hostedtoolcache/dotnet
2024-11-15T20:57:53.7600247Z ##[debug]set DOTNET_MULTILEVEL_LOOKUP=0
2024-11-15T20:57:53.7601581Z ##[debug]Processed: ##vso[task.setvariable variable=DOTNET_MULTILEVEL_LOOKUP;isOutput=false;issecret=false;]0
2024-11-15T20:57:53.7602377Z Creating global tool path and pre-pending to PATH.
2024-11-15T20:57:53.7603278Z ##[debug]testing directory '/home/vsts/.dotnet/tools'
2024-11-15T20:57:53.7604750Z ##[debug]Agent.Version=3.246.0
2024-11-15T20:57:53.7607722Z ##[debug]Processed: ##vso[task.prependpath]/home/vsts/.dotnet/tools
2024-11-15T20:57:53.7612535Z ##[debug]Agent.ProxyUrl=undefined
2024-11-15T20:57:53.7613786Z ##[debug]task result: Succeeded
2024-11-15T20:57:53.7615552Z ##[debug]Processed: ##vso[task.complete result=Succeeded;]
2024-11-15T20:57:53.7737704Z ##[section]Finishing: UseDotNet
Hi @alex-zyl thank you for reporting this issue. We are currently working on higher-prioritized issues, but we will get back to this one as soon as possible
New issue checklist
Task name
UseDotNet@2
Task version
2.247.1
Issue Description
After calling UseDotNet@2 task, the new .NET SDK location is changed from
/usr/share/dotnet/sdk
to/opt/hostedtoolcache/dotnet
making pre-installed SDKs no longer available.Environment type (Please select at least one enviroment where you face this issue)
Azure DevOps Server type
dev.azure.com (formerly visualstudio.com)
Azure DevOps Server Version (if applicable)
No response
Operation system
Ubuntu-latest
Relevant log output
Full task logs with system.debug enabled
Repro steps