Attempts to install .NET 6.0.403 have been failing on various jobs:
Error: Unable to download https://dotnetcli.blob.core.windows.net/public/Sdk/6.0.403/dotnet-dev-win-x64.6.0.403.zip. Returned HTTP status code: 404
Could not find ".NET Core SDK" with version = 6.0.403
Fix this by preferring the default feed found in the dotnet-install.ps1
script.
42 lines
1.2 KiB
PowerShell
42 lines
1.2 KiB
PowerShell
Param(
|
|
[string] $Version,
|
|
[string] $InstallDir,
|
|
[string] $FeedUrl = "https://dotnetcli.azureedge.net/dotnet"
|
|
)
|
|
|
|
$ErrorActionPreference = 'Stop'
|
|
|
|
$dotnetDll = Join-Path "$InstallDir" "sdk" "$Version" "dotnet.dll"
|
|
if (Test-Path $dotnetDll) {
|
|
Write-Host ".NET already installed."
|
|
} else {
|
|
if ($IsMacOS -or $IsLinux) {
|
|
$url = "https://dot.net/v1/dotnet-install.sh"
|
|
} else {
|
|
$url = "https://dot.net/v1/dotnet-install.ps1"
|
|
}
|
|
|
|
Write-Host "Downloading .NET Installer..."
|
|
Invoke-WebRequest `
|
|
-Uri "$url" `
|
|
-OutFile (Split-Path $url -Leaf)
|
|
|
|
Write-Host "Installing .NET $Version..."
|
|
if ($IsMacOS) {
|
|
& sh dotnet-install.sh --version "$Version" --install-dir "$InstallDir" --azure-feed "$FeedUrl" --verbose
|
|
} elseif ($IsLinux) {
|
|
& bash dotnet-install.sh --version "$Version" --install-dir "$InstallDir" --azure-feed "$FeedUrl" --verbose
|
|
} else {
|
|
.\dotnet-install.ps1 -Version "$Version" -InstallDir "$InstallDir" -AzureFeed "$FeedUrl" -Verbose
|
|
}
|
|
}
|
|
|
|
if (-not $env:PATH.Contains($InstallDir)) {
|
|
$env:PATH = "$InstallDir" + [IO.Path]::PathSeparator + "$env:PATH"
|
|
Write-Host "##vso[task.setvariable variable=PATH;]$env:PATH"
|
|
}
|
|
|
|
Write-Host "Checking all dotnet info..."
|
|
& dotnet --info
|
|
|
|
exit $LASTEXITCODE
|