Skip to content

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

@carlossanlop

Description

@carlossanlop

Related to: dotnet/roslyn-analyzers#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.

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
From:

 function InstallDotNetSdk([string] $dotnetRoot, [string] $version, [string] $architecture = '') { 
   InstallDotNet $dotnetRoot $version $architecture 
 }

To:

 function InstallDotNetSdk([string] $dotnetRoot, [string] $version, [string] $architecture = 'x86') { 
   InstallDotNet $dotnetRoot $version x86
 }

cc @jmarolf

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions