From b5421c953603a212ad643eff481e9d26ffa11625 Mon Sep 17 00:00:00 2001 From: kishorekumar-anchala <168699259+kishorekumar-anchala@users.noreply.github.com> Date: Fri, 28 Feb 2025 18:25:17 +0000 Subject: [PATCH] [windows 22 & 25 ] Upgrade visual studio to postGRO channel (#11595) * [windows 22 and 25 Upgrade visual studio to postGRO * Add condition for windows 19 to skip * [Windows] Update Vs installation script * Refactor the visual studio installation script * Fix windows 19 faliure * Fix windows 19 visual studio failure * [windows] Fix Windows 19 failure * Add condition for windows 19 * [windows] Fix windows 19 failure * [windows] update script by changing the condition syntax * Make installchannel as optioanl parametr * Update Installer script * [ windows ] Update the installation script with conditional statement * Update the installation script * Update toolsets * Update the channel ID * Update channel ID * Resolve conflicts * Resolve conflicts --- .../scripts/build/Install-VisualStudio.ps1 | 31 +++++++++++++------ .../scripts/helpers/VisualStudioHelpers.ps1 | 15 +++++++-- images/windows/toolsets/toolset-2022.json | 3 +- images/windows/toolsets/toolset-2025.json | 3 +- 4 files changed, 39 insertions(+), 13 deletions(-) diff --git a/images/windows/scripts/build/Install-VisualStudio.ps1 b/images/windows/scripts/build/Install-VisualStudio.ps1 index a4b66e7ca..203dd4cc7 100644 --- a/images/windows/scripts/build/Install-VisualStudio.ps1 +++ b/images/windows/scripts/build/Install-VisualStudio.ps1 @@ -2,17 +2,30 @@ ## File: Install-VisualStudio.ps1 ## Desc: Install Visual Studio ################################################################################ - $vsToolset = (Get-ToolsetContent).visualStudio -# Install VS -Install-VisualStudio ` - -Version $vsToolset.subversion ` - -Edition $vsToolset.edition ` - -Channel $vsToolset.channel ` - -RequiredComponents $vsToolset.workloads ` - -ExtraArgs "--allWorkloads --includeRecommended --remove Component.CPython3.x64" ` - -SignatureThumbprint $vsToolset.signature +if (Test-IsWin19) { + # Install Visual Studio for Windows 19 + Install-VisualStudio ` + -Version $vsToolset.subversion ` + -Edition $vsToolset.edition ` + -Channel $vsToolset.channel ` + -RequiredComponents $vsToolset.workloads ` + -ExtraArgs "--allWorkloads --includeRecommended --remove Component.CPython3.x64" ` + -SignatureThumbprint $vsToolset.signature +} + +if ( (Test-IsWin22) -or (Test-IsWin25) ) { + # Install Visual Studio for Windows 22 and 25 with InstallChannel + Install-VisualStudio ` + -Version $vsToolset.subversion ` + -Edition $vsToolset.edition ` + -Channel $vsToolset.channel ` + -InstallChannel $vsToolset.installChannel ` + -RequiredComponents $vsToolset.workloads ` + -ExtraArgs "--allWorkloads --includeRecommended --remove Component.CPython3.x64" ` + -SignatureThumbprint $vsToolset.signature +} # Find the version of VS installed for this instance # Only supports a single instance diff --git a/images/windows/scripts/helpers/VisualStudioHelpers.ps1 b/images/windows/scripts/helpers/VisualStudioHelpers.ps1 index 44f8bb32c..6a2a756f8 100644 --- a/images/windows/scripts/helpers/VisualStudioHelpers.ps1 +++ b/images/windows/scripts/helpers/VisualStudioHelpers.ps1 @@ -14,6 +14,9 @@ Function Install-VisualStudio { .PARAMETER Channel The channel of Visual Studio that will be installed. Required parameter. + + .PARAMETER InstallChannel + The InstallChannelUri of Visual Studio that will be installed. Required parameter. .PARAMETER RequiredComponents The list of required components. Required parameter. @@ -27,15 +30,22 @@ Function Install-VisualStudio { [Parameter(Mandatory)] [String] $Version, [Parameter(Mandatory)] [String] $Edition, [Parameter(Mandatory)] [String] $Channel, + [String] $InstallChannel = "", [Parameter(Mandatory)] [String[]] $RequiredComponents, [String] $ExtraArgs = "", [Parameter(Mandatory)] [String[]] $SignatureThumbprint ) - - $bootstrapperUrl = "https://aka.ms/vs/${Version}/${Channel}/vs_${Edition}.exe" + + + if (-not (Test-IsWin19)) { + $bootstrapperUrl = "https://aka.ms/vs/${Version}/postGRO-${Channel}/vs_${Edition}.exe" + } else { + $bootstrapperUrl = "https://aka.ms/vs/${Version}/${Channel}/vs_${Edition}.exe" + } $channelUri = "https://aka.ms/vs/${Version}/${Channel}/channel" $channelId = "VisualStudio.${Version}.Release" $productId = "Microsoft.VisualStudio.Product.${Edition}" + $installChannelUri = "https://aka.ms/vs/${Version}/${Channel}/${installchannel}/channel" Write-Host "Downloading Bootstrapper ..." $bootstrapperFilePath = Invoke-DownloadWithRetry $BootstrapperUrl @@ -45,6 +55,7 @@ Function Install-VisualStudio { try { $responseData = @{ + "installChannelUri" = $installChannelUri "channelUri" = $channelUri "channelId" = $channelId "productId" = $productId diff --git a/images/windows/toolsets/toolset-2022.json b/images/windows/toolsets/toolset-2022.json index a2230c8b2..99981a125 100644 --- a/images/windows/toolsets/toolset-2022.json +++ b/images/windows/toolsets/toolset-2022.json @@ -180,6 +180,7 @@ "subversion" : "17", "edition" : "Enterprise", "channel": "release", + "installChannel": "658092423_1519083591", "signature": [ "245D262748012A4FE6CE8BA6C951A4C4AFBC3E5D", "8F985BE8FD256085C90A95D3C74580511A1DB975" @@ -405,4 +406,4 @@ "pwsh": { "version": "7.4" } -} +} \ No newline at end of file diff --git a/images/windows/toolsets/toolset-2025.json b/images/windows/toolsets/toolset-2025.json index df957602d..3ae7cd19e 100644 --- a/images/windows/toolsets/toolset-2025.json +++ b/images/windows/toolsets/toolset-2025.json @@ -137,6 +137,7 @@ "subversion" : "17", "edition" : "Enterprise", "channel": "release", + "installChannel": "658092423_1519083591", "signature": [ "245D262748012A4FE6CE8BA6C951A4C4AFBC3E5D", "8F985BE8FD256085C90A95D3C74580511A1DB975" @@ -339,4 +340,4 @@ "pwsh": { "version": "7.4" } -} +} \ No newline at end of file