vcpkg/scripts/azure-pipelines/windows/deploy-visual-studio.ps1
Billy O'Neal ba1465e584
Patch Tuesday for February 2024 (#36757)
* Cherry-pick infrastructure changes from
https://github.com/microsoft/vcpkg/pull/36081 as authored by @dg0yt
* Suppress warnings for the monthly docker mint as suggested by Toddy
Mladenov ( MS internal conversation
https://teams.microsoft.com/l/message/19:f498f444e97f40b2a2027d015a9047ab@thread.tacv2/1707520630587?tenantId=72f988bf-86f1-41af-91ab-2d7cd011db47&groupId=2080ccbe-0cfb-49e6-a9c1-ea6a6bf82722&parentMessageId=1707520630587&teamName=Containers%20Secure%20Supply%20Chain&channelName=3P%20Registry%20and%20Images%20Guidance&createdTime=1707520630587
)
* Move Azure Container Registry for Android to WestUS3; with this we are
officially entirely within one Azure region again :D
* Explicitly grant Azure DevOps permissions to touch the scale set
rather than relying on subscription-level assignments.
2024-02-21 16:30:42 -08:00

90 lines
3.0 KiB
PowerShell

# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: MIT
# REPLACE WITH DROP-TO-ADMIN-USER-PREFIX.ps1
# REPLACE WITH UTILITY-PREFIX.ps1
$VisualStudioBootstrapperUrl = 'https://download.visualstudio.microsoft.com/download/pr/03aef663-a3da-4cdd-ac33-9ff2935267ba/d08ca31938fde015b2fec26b18149cfd21a99b69309ac2726c00658d67e7ed4c/vs_Enterprise.exe'
$Workloads = @(
'Microsoft.VisualStudio.Workload.NativeDesktop',
'Microsoft.VisualStudio.Workload.Universal',
'Microsoft.VisualStudio.Component.UWP.VC.ARM64',
'Microsoft.VisualStudio.Component.VC.Tools.x86.x64',
'Microsoft.VisualStudio.Component.VC.Tools.ARM64',
'Microsoft.VisualStudio.Component.VC.ASAN',
'Microsoft.VisualStudio.Component.VC.ATL',
'Microsoft.VisualStudio.Component.VC.ATLMFC',
'Microsoft.VisualStudio.Component.VC.ATL.ARM64',
'Microsoft.VisualStudio.Component.VC.MFC.ARM64',
"Microsoft.VisualStudio.Component.Windows11SDK.22621",
"Microsoft.VisualStudio.Component.Windows10SDK.20348",
'Microsoft.Net.Component.4.8.SDK',
'Microsoft.Net.Component.4.7.2.TargetingPack',
'Microsoft.Component.NetFX.Native',
'Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset',
'Microsoft.VisualStudio.Component.VC.Llvm.Clang',
'Microsoft.VisualStudio.ComponentGroup.UWP.VC.BuildTools',
'Microsoft.VisualStudio.Component.VC.CMake.Project'
)
<#
.SYNOPSIS
Install Visual Studio.
.DESCRIPTION
InstallVisualStudio takes the $Workloads array, and installs it with the
installer that's pointed at by $BootstrapperUrl.
.PARAMETER Workloads
The set of VS workloads to install.
.PARAMETER BootstrapperUrl
The URL of the Visual Studio installer, i.e. one of vs_*.exe.
.PARAMETER InstallPath
The path to install Visual Studio at.
.PARAMETER Nickname
The nickname to give the installation.
#>
Function InstallVisualStudio {
Param(
[String[]]$Workloads,
[String]$BootstrapperUrl,
[String]$InstallPath = $null,
[String]$Nickname = $null
)
try {
Write-Host 'Downloading Visual Studio...'
[string]$bootstrapperExe = Get-TempFilePath -Extension 'exe'
curl.exe -L -o $bootstrapperExe -s -S $BootstrapperUrl
Write-Host 'Installing Visual Studio...'
$vsArgs = @('/c', $bootstrapperExe, '--quiet', '--norestart', '--wait', '--nocache')
foreach ($workload in $Workloads) {
$vsArgs += '--add'
$vsArgs += $workload
}
if (-not ([String]::IsNullOrWhiteSpace($InstallPath))) {
$vsArgs += '--installpath'
$vsArgs += $InstallPath
}
if (-not ([String]::IsNullOrWhiteSpace($Nickname))) {
$vsArgs += '--nickname'
$vsArgs += $Nickname
}
$proc = Start-Process -FilePath cmd.exe -ArgumentList $vsArgs -Wait -PassThru
PrintMsiExitCodeMessage $proc.ExitCode
}
catch {
Write-Error "Failed to install Visual Studio! $($_.Exception.Message)"
throw
}
}
InstallVisualStudio -Workloads $Workloads -BootstrapperUrl $VisualStudioBootstrapperUrl -Nickname 'Stable'