mirror of
https://github.com/actions/runner-images.git
synced 2025-12-14 22:05:17 +00:00
[Windows] Improve Visual Studio installation scripts to support Preview versions (#3850)
* Support Preview versions of Visual Studio * resolve comments * Fix test * fix tests
This commit is contained in:
@@ -72,16 +72,14 @@ function Get-VsCatalogJsonPath {
|
||||
return Join-Path $instanceFolder.FullName "catalog.json"
|
||||
}
|
||||
|
||||
function Get-VisualStudioPath {
|
||||
return (Get-VSSetupInstance | Select-VSSetupInstance -Product *).InstallationPath
|
||||
}
|
||||
|
||||
function Get-VisualStudioPackages {
|
||||
return (Get-VSSetupInstance | Select-VSSetupInstance -Product *).Packages
|
||||
function Get-VisualStudioInstance {
|
||||
# Use -Prerelease and -All flags to make sure that Preview versions of VS are found correctly
|
||||
$vsInstance = Get-VSSetupInstance -Prerelease -All | Where-Object { $_.DisplayName -match "Visual Studio" } | Select-Object -First 1
|
||||
$vsInstance | Select-VSSetupInstance -Product *
|
||||
}
|
||||
|
||||
function Get-VisualStudioComponents {
|
||||
Get-VisualStudioPackages | Where-Object type -in 'Component', 'Workload' |
|
||||
(Get-VisualStudioInstance).Packages | Where-Object type -in 'Component', 'Workload' |
|
||||
Sort-Object Id, Version | Select-Object @{n = 'Package'; e = {$_.Id}}, Version |
|
||||
Where-Object { $_.Package -notmatch "[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}" }
|
||||
}
|
||||
Reference in New Issue
Block a user