mirror of
https://github.com/actions/runner-images.git
synced 2025-12-19 00:06:57 +00:00
[Windows] use VsixInstaller from the installer (#8103)
This commit is contained in:
@@ -272,8 +272,6 @@ function Install-VsixExtension
|
|||||||
[Parameter(Mandatory = $true)]
|
[Parameter(Mandatory = $true)]
|
||||||
[string] $Name,
|
[string] $Name,
|
||||||
[string] $FilePath,
|
[string] $FilePath,
|
||||||
[Parameter(Mandatory = $true)]
|
|
||||||
[string] $VSversion,
|
|
||||||
[int] $Retries = 20,
|
[int] $Retries = 20,
|
||||||
[switch] $InstallOnly
|
[switch] $InstallOnly
|
||||||
)
|
)
|
||||||
@@ -288,20 +286,14 @@ function Install-VsixExtension
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
Write-Host "Starting Install $Name..."
|
Write-Host "Starting Install $Name..."
|
||||||
$vsEdition = (Get-ToolsetContent).visualStudio.edition
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$installPath = ${env:ProgramFiles(x86)}
|
$installPath = ${env:ProgramFiles(x86)}
|
||||||
|
|
||||||
if (Test-IsWin22)
|
# There are 2 types of packages at the moment - exe and vsix
|
||||||
{
|
|
||||||
$installPath = ${env:ProgramFiles}
|
|
||||||
}
|
|
||||||
|
|
||||||
#There are 2 types of packages at the moment - exe and vsix
|
|
||||||
if ($Name -match "vsix")
|
if ($Name -match "vsix")
|
||||||
{
|
{
|
||||||
$process = Start-Process -FilePath "${installPath}\Microsoft Visual Studio\${VSversion}\${vsEdition}\Common7\IDE\VSIXInstaller.exe" -ArgumentList $argumentList -Wait -PassThru
|
$process = Start-Process -FilePath "${installPath}\Microsoft Visual Studio\Installer\resources\app\ServiceHub\Services\Microsoft.VisualStudio.Setup.Service\VSIXInstaller.exe" -ArgumentList $argumentList -Wait -PassThru
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -327,7 +319,8 @@ function Install-VsixExtension
|
|||||||
$Retries--
|
$Retries--
|
||||||
if ($Retries -eq 0) {
|
if ($Retries -eq 0) {
|
||||||
Write-Host "The $Name couldn't be installed after 20 attempts."
|
Write-Host "The $Name couldn't be installed after 20 attempts."
|
||||||
}else {
|
exit 1
|
||||||
|
} else {
|
||||||
Write-Host "Waiting 10 seconds before retrying. Retries left: $Retries"
|
Write-Host "Waiting 10 seconds before retrying. Retries left: $Retries"
|
||||||
Start-Sleep -Seconds 10
|
Start-Sleep -Seconds 10
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,12 +10,11 @@ if (-not $vsixPackagesList) {
|
|||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
$vsVersion = $toolset.visualStudio.Version
|
|
||||||
$vsixPackagesList | ForEach-Object {
|
$vsixPackagesList | ForEach-Object {
|
||||||
# Retrieve cdn endpoint to avoid HTTP error 429 https://github.com/actions/runner-images/issues/3074
|
# Retrieve cdn endpoint to avoid HTTP error 429 https://github.com/actions/runner-images/issues/3074
|
||||||
$vsixPackage = Get-VsixExtenstionFromMarketplace -ExtensionMarketPlaceName $_
|
$vsixPackage = Get-VsixExtenstionFromMarketplace -ExtensionMarketPlaceName $_
|
||||||
if ($vsixPackage.FileName.EndsWith(".vsix")) {
|
if ($vsixPackage.FileName.EndsWith(".vsix")) {
|
||||||
Install-VsixExtension -Url $vsixPackage.DownloadUri -Name $vsixPackage.FileName -VSversion $vsVersion
|
Install-VsixExtension -Url $vsixPackage.DownloadUri -Name $vsixPackage.FileName
|
||||||
} else {
|
} else {
|
||||||
$argumentList = ('/install', '/quiet', '/norestart')
|
$argumentList = ('/install', '/quiet', '/norestart')
|
||||||
Install-Binary -Url $vsixPackage.DownloadUri -Name $vsixPackage.FileName -ArgumentList $argumentList
|
Install-Binary -Url $vsixPackage.DownloadUri -Name $vsixPackage.FileName -ArgumentList $argumentList
|
||||||
|
|||||||
@@ -8,12 +8,10 @@ if (Test-IsWin22) {
|
|||||||
# SDK available through Visual Studio
|
# SDK available through Visual Studio
|
||||||
$wdkUrl = "https://go.microsoft.com/fwlink/?linkid=2196230"
|
$wdkUrl = "https://go.microsoft.com/fwlink/?linkid=2196230"
|
||||||
$FilePath = "C:\Program Files (x86)\Windows Kits\10\Vsix\VS2022\*\WDK.vsix"
|
$FilePath = "C:\Program Files (x86)\Windows Kits\10\Vsix\VS2022\*\WDK.vsix"
|
||||||
$VSver = "2022"
|
|
||||||
} elseif (Test-IsWin19) {
|
} elseif (Test-IsWin19) {
|
||||||
$winSdkUrl = "https://go.microsoft.com/fwlink/?linkid=2173743"
|
$winSdkUrl = "https://go.microsoft.com/fwlink/?linkid=2173743"
|
||||||
$wdkUrl = "https://go.microsoft.com/fwlink/?linkid=2166289"
|
$wdkUrl = "https://go.microsoft.com/fwlink/?linkid=2166289"
|
||||||
$FilePath = "C:\Program Files (x86)\Windows Kits\10\Vsix\VS2019\WDK.vsix"
|
$FilePath = "C:\Program Files (x86)\Windows Kits\10\Vsix\VS2019\WDK.vsix"
|
||||||
$VSver = "2019"
|
|
||||||
} else {
|
} else {
|
||||||
throw "Invalid version of Visual Studio is found. Either 2019 or 2022 are required"
|
throw "Invalid version of Visual Studio is found. Either 2019 or 2022 are required"
|
||||||
}
|
}
|
||||||
@@ -30,6 +28,6 @@ Install-Binary -Url $wdkUrl -Name "wdksetup.exe" -ArgumentList $argumentList
|
|||||||
|
|
||||||
# Need to install the VSIX to get the build targets when running VSBuild
|
# Need to install the VSIX to get the build targets when running VSBuild
|
||||||
$FilePath = Resolve-Path -Path $FilePath
|
$FilePath = Resolve-Path -Path $FilePath
|
||||||
Install-VsixExtension -FilePath $FilePath -Name "WDK.vsix" -VSversion $VSver -InstallOnly
|
Install-VsixExtension -FilePath $FilePath -Name "WDK.vsix" -InstallOnly
|
||||||
|
|
||||||
Invoke-PesterTests -TestFile "WDK"
|
Invoke-PesterTests -TestFile "WDK"
|
||||||
|
|||||||
Reference in New Issue
Block a user