From 587a8c8e6fd8bf320282e3465d88c8aa50bbd79c Mon Sep 17 00:00:00 2001 From: ilia-shipitsin <125650415+ilia-shipitsin@users.noreply.github.com> Date: Fri, 1 Sep 2023 11:44:00 +0200 Subject: [PATCH] [windows] cleanup DotNETSdk install script (#8200) * [win] some cleanup of DonetSDK installer FixPublish workaround not needed anymore, we do not install 3.1 C:\Temp not needed as well --- .../scripts/Installers/Install-DotnetSDK.ps1 | 21 +++---------------- 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/images/win/scripts/Installers/Install-DotnetSDK.ps1 b/images/win/scripts/Installers/Install-DotnetSDK.ps1 index 6b0f650a..fb4caff7 100644 --- a/images/win/scripts/Installers/Install-DotnetSDK.ps1 +++ b/images/win/scripts/Installers/Install-DotnetSDK.ps1 @@ -4,9 +4,6 @@ ## cache. Should run after VS and Node ################################################################################ -# ensure temp -New-Item -Path C:\Temp -Force -ItemType Directory - # Set environment variables Set-SystemVariable -SystemVariable DOTNET_MULTILEVEL_LOOKUP -Value "0" Set-SystemVariable -SystemVariable DOTNET_NOLOGO -Value "1" @@ -14,6 +11,7 @@ Set-SystemVariable -SystemVariable DOTNET_SKIP_FIRST_TIME_EXPERIENCE -Value "1" [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor "Tls12" +#region "Functions" function Get-SDKVersionsToInstall ( $DotnetVersion ) { @@ -52,18 +50,6 @@ function Invoke-Warmup ( } } -function Fix-ImportPublishProfile ( - $SdkVersion -) { - if (Test-IsWin19) { - # Fix for issue https://github.com/dotnet/sdk/issues/1276. This will be fixed in 3.1. - $sdkTargetsName = "Microsoft.NET.Sdk.ImportPublishProfile.targets" - $sdkTargetsUrl = "https://raw.githubusercontent.com/dotnet/sdk/82bc30c99f1325dfaa7ad450be96857a4fca2845/src/Tasks/Microsoft.NET.Build.Tasks/targets/${sdkTargetsName}" - $sdkTargetsPath = "C:\Program Files\dotnet\sdk\$sdkVersion\Sdks\Microsoft.NET.Sdk\targets" - Start-DownloadWithRetry -Url $sdkTargetsUrl -DownloadPath $sdkTargetsPath -Name $sdkTargetsName - } -} - function InstallSDKVersion ( $SdkVersion, $Warmup @@ -72,15 +58,13 @@ function InstallSDKVersion ( if (!(Test-Path -Path "C:\Program Files\dotnet\sdk\$sdkVersion")) { Write-Host "Installing dotnet $sdkVersion" - .\dotnet-install.ps1 -Architecture x64 -Version $sdkVersion -InstallDir $(Join-Path -Path $env:ProgramFiles -ChildPath 'dotnet') + .\dotnet-install.ps1 -Version $sdkVersion -InstallDir $(Join-Path -Path $env:ProgramFiles -ChildPath 'dotnet') } else { Write-Host "Sdk version $sdkVersion already installed" } - Fix-ImportPublishProfile -SdkVersion $SdkVersion - if ($Warmup) { Invoke-Warmup -SdkVersion $SdkVersion } @@ -138,6 +122,7 @@ function RunPostInstallationSteps() # Add %USERPROFILE%\.dotnet\tools to USER PATH Add-DefaultPathItem "%USERPROFILE%\.dotnet\tools" } +#endregion InstallAllValidSdks RunPostInstallationSteps