diff --git a/eng/scripts/Automation-Sdk-Init.ps1 b/eng/scripts/Automation-Sdk-Init.ps1 index 0d8384f99af8..c0784af025e6 100644 --- a/eng/scripts/Automation-Sdk-Init.ps1 +++ b/eng/scripts/Automation-Sdk-Init.ps1 @@ -37,11 +37,16 @@ $GlobalJson = Get-Content -Raw -Path (Join-Path $RepoRoot 'global.json') | Conve $dotnetSdkVersion = $GlobalJson.sdk.version $installScript = GetDotNetInstallScript - -$dotnet = Join-Path $RepoRoot "../dotnetsdk" + +if (-not (Test-Path Env:AGENT_TOOLSDIRECTORY)) +{ + $Env:AGENT_TOOLSDIRECTORY = Join-Path $RepoRoot ".." +} +Write-Host $Env:AGENT_TOOLSDIRECTORY +$dotnet = Join-Path $Env:AGENT_TOOLSDIRECTORY "dotnetsdk" & bash $installScript --install-dir $dotnet --version $dotnetSdkVersion -$env:PATH = "$dotnet`:" + $env:PATH +$Env:PATH = "$dotnet`:" + $Env:PATH dotnet --version | Write-Host if (Test-Path $installScript) {