From 325070bdee127bc57c5943f14c27a70f5d73335b Mon Sep 17 00:00:00 2001 From: Dibir Magomedsaygitov Date: Tue, 10 Nov 2020 01:15:37 +0300 Subject: [PATCH] install dotnet 5.0 and rework installation logic --- images/win/scripts/Installers/Install-DotnetSDK.ps1 | 13 ++++--------- images/win/toolsets/toolset-2016.json | 10 +++++++++- images/win/toolsets/toolset-2019.json | 9 ++++++++- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/images/win/scripts/Installers/Install-DotnetSDK.ps1 b/images/win/scripts/Installers/Install-DotnetSDK.ps1 index 7b91c7aca..12b4a701c 100644 --- a/images/win/scripts/Installers/Install-DotnetSDK.ps1 +++ b/images/win/scripts/Installers/Install-DotnetSDK.ps1 @@ -55,24 +55,19 @@ function InstallSDKVersion ( function InstallAllValidSdks() { - $releaseIndexName = "releases-index.json" - $releaseIndexUrl = "https://raw.githubusercontent.com/dotnet/core/master/release-notes/${releaseIndexName}" - $releasesIndexPath = Start-DownloadWithRetry -Url $releaseIndexUrl -Name $releaseIndexName - $dotnetChannels = Get-Content -Path $releasesIndexPath | ConvertFrom-Json - # Consider all channels except preview/eol channels. # Sort the channels in ascending order - $dotnetChannels = $dotnetChannels.'releases-index' | Where-Object { (!$_."support-phase".Equals('preview') -and !$_."support-phase".Equals('eol') -and !$_."support-phase".Equals('rc')) } | Sort-Object { [Version] $_."channel-version" } + $dotnetVersions = (Get-ToolsetContent).dotnet.versions # Download installation script. $installationName = "dotnet-install.ps1" $installationUrl = "https://dot.net/v1/${installationName}" Start-DownloadWithRetry -Url $installationUrl -Name $installationName -DownloadPath ".\" - ForEach ($dotnetChannel in $dotnetChannels) + ForEach ($dotnetVersion in $dotnetVersions) { - $channelVersion = $dotnetChannel.'channel-version'; - $releasesJsonPath = Start-DownloadWithRetry -Url $dotnetChannel.'releases.json' -Name "releases-$channelVersion.json" + $releaseJson = "https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/${dotnetVersion}/releases.json" + $releasesJsonPath = Start-DownloadWithRetry -Url $releaseJson -Name "releases-${dotnetVersion}.json" $currentReleases = Get-Content -Path $releasesJsonPath | ConvertFrom-Json # filtering out the preview/rc releases $currentReleases = $currentReleases.'releases' | Where-Object { !$_.'release-version'.Contains('-') } | Sort-Object { [Version] $_.'release-version' } diff --git a/images/win/toolsets/toolset-2016.json b/images/win/toolsets/toolset-2016.json index f5d30694b..e612645bb 100644 --- a/images/win/toolsets/toolset-2016.json +++ b/images/win/toolsets/toolset-2016.json @@ -243,5 +243,13 @@ "package": "yamllint", "cmd": "yamllint --version" } - ] + ], + "dotnet": { + "versions": [ + "1.1", + "2.1", + "3.1", + "5.0" + ] + } } diff --git a/images/win/toolsets/toolset-2019.json b/images/win/toolsets/toolset-2019.json index ebb7aa826..94e0f93c2 100644 --- a/images/win/toolsets/toolset-2019.json +++ b/images/win/toolsets/toolset-2019.json @@ -286,5 +286,12 @@ "package": "yamllint", "cmd": "yamllint --version" } - ] + ], + "dotnet": { + "versions": [ + "2.1", + "3.1", + "5.0" + ] + } }