Skip to content

Commit b26fa56

Browse files
committed
Fix Find-DotNet in global tools
1 parent 9d446b3 commit b26fa56

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

.pipelines/templates/release-validate-globaltools.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,18 @@ jobs:
8585
8686
$toolPath = "$(System.DefaultWorkingDirectory)/toolPath/${{ parameters.globalToolExeName }}"
8787
88-
Find-Dotnet -SetDotNetRoot
88+
$source = (get-command -Type Application -Name dotnet | Select-Object -First 1 -ExpandProperty source)
89+
$target = (Get-ChildItem $source).target
8990
91+
# If we find a symbolic link for dotnet, then we need to split the filename off the target.
92+
if ($target) {
93+
Write-Verbose -Verbose "Splitting target: $target"
94+
$target = Split-Path $target
95+
}
96+
97+
Write-Verbose -Verbose "target is set as $target"
98+
99+
$env:DOTNET_ROOT = (resolve-path -Path (Join-Path (split-path $source) $target)).ProviderPath
90100
Write-Verbose -Verbose "DOTNET_ROOT: $env:DOTNET_ROOT"
91101
Get-ChildItem $env:DOTNET_ROOT
92102

0 commit comments

Comments
 (0)