Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions eng/common/tools.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,23 @@ function InitializeDotNetCli([bool]$install, [bool]$createSdkLocationFile) {
$dotnetRoot = $env:DOTNET_INSTALL_DIR
} else {
$dotnetRoot = Join-Path $RepoRoot '.dotnet'
if ($env:DOTNET_USE_ARCH_IN_INSTALL_PATH -eq "1") {
$osArchitecture = [System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture
if ($osArchitecture) {
$rid = "win-$osArchitecture".ToLowerInvariant()
} else {
# netfx / desktop
$osArchitecture = (Get-CimInstance -ClassName Win32_OperatingSystem).OSArchitecture
switch -Wildcard ($osArchitecture) {
"*ARM 64-bit*" { $rid = "win-arm64"; break }
"*ARM*" { $rid = "win-arm"; break }
"*32-bit*" { $rid = "win-x86"; break }
"*64-bit*" { $rid = "win-x64"; break }
}
}

$dotnetRoot = Join-Path $dotnetRoot $rid
}

if (-not (Test-Path(Join-Path $dotnetRoot "sdk\$dotnetSdkVersion"))) {
if ($install) {
Expand Down
5 changes: 5 additions & 0 deletions eng/common/tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ function InitializeDotNetCli {
dotnet_root="$DOTNET_INSTALL_DIR"
else
dotnet_root="${repo_root}.dotnet"
if [[ "${DOTNET_USE_ARCH_IN_INSTALL_PATH:-}" == "1" ]]; then
. "$_script_dir/native/init-os-and-arch.sh"
if (ldd --version 2>&1 || true) | grep -q musl; then os="${os}-musl"; fi
dotnet_root="${dotnet_root}/${os}-${arch}"
fi

export DOTNET_INSTALL_DIR="$dotnet_root"

Expand Down