dotnet / dotnet/arcade

In ARM64, fallback to ARM32/x86 if SDK installer is not found

Open
#5,885 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
729
Forks
397
Avg merge
3d 15m
Merged PRs (30d)
149

Description

Related to: https://github.com/dotnet/roslyn-analyzers/issues/3933

If the architecture is arm64, but the dotnet-install script does not find an SDK installer for that architecture, fallback to arm32. And if no arm32 SDK installer is found, fallback to x86.

Here is the output of `build.cmd` from the roslyn-analyzers repo, when executed from my ARM64 machine:

```
C:\User\carlos\source\repos\roslyn-analyzers ❯ .\Build.cmd
dotnet-install: Downloading link: https://dotnetcli.azureedge.net/dotnet/Sdk/3.1.200/dotnet-sdk-3.1.200-win-arm64.zip
dotnet-install: Cannot download: https://dotnetcli.azureedge.net/dotnet/Sdk/3.1.200/dotnet-sdk-3.1.200-win-arm64.zip
dotnet-install: Downloading legacy link: https://dotnetcli.azureedge.net/dotnet/Sdk/3.1.200/dotnet-dev-win-arm64.3.1.200.zip
dotnet-install: Cannot download: https://dotnetcli.azureedge.net/dotnet/Sdk/3.1.200/dotnet-dev-win-arm64.3.1.200.zip
Failed to install dotnet runtime '' from public location.
```
The ARM64 SDK installer [does not exist for 3.1](https://dotnet.microsoft.com/download/dotnet-core/3.1).

So I had to hardcode the `$architecture = ''` argument to `x86` in the script that attempts the installation, so that I could get a successful compilation:

[roslyn-analyzers/eng/common/tools.ps1#L223-L225](https://github.com/dotnet/roslyn-analyzers/blob/7bc7660d8f01dbc06fd8d1ac672e44c1d033f5dc/eng/common/tools.ps1#L223-L225)
From:
```powershell
function InstallDotNetSdk([string] $dotnetRoot, [string] $version, [string] $architecture = '') {
InstallDotNet $dotnetRoot $version $architecture
}
```
To:
```powershell
function InstallDotNetSdk([string] $dotnetRoot, [string] $version, [string] $architecture = 'x86') {
InstallDotNet $dotnetRoot $version x86
}
```

cc @jmarolf

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.