mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-20 06:29:50 +00:00
Add SQL Server Data Tools extensions to VS2019 (#559)
* add extensions * add exe installation * change Reporting Services name * add switch to function, add validation * change install wdk to function * Fix template * fix scripts name * add quotes * more quotes * one more quotes * get rid of duplicate code * move quotes to function * small improvment to wix installation * add comment to validate extensions script
This commit is contained in:
@@ -165,46 +165,62 @@ function Install-VsixExtension
|
||||
{
|
||||
Param
|
||||
(
|
||||
[String]$Url,
|
||||
[String]$Name
|
||||
[string] $Url,
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string] $Name,
|
||||
[string] $FilePath,
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string] $VSversion,
|
||||
[int] $retries = 20,
|
||||
[switch] $InstallOnly
|
||||
)
|
||||
|
||||
$FilePath = "${env:Temp}\$Name"
|
||||
$retries = 20
|
||||
|
||||
while($retries -gt 0)
|
||||
if (!$InstallOnly)
|
||||
{
|
||||
try
|
||||
{
|
||||
Write-Host "Downloading $Name..."
|
||||
(New-Object System.Net.WebClient).DownloadFile($Url, $FilePath)
|
||||
break
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Host "There is an error during $Name downloading"
|
||||
$_
|
||||
$FilePath = "${env:Temp}\$Name"
|
||||
|
||||
$retries--
|
||||
|
||||
if ($retries -eq 0)
|
||||
while($retries -gt 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
Write-Host "File can't be downloaded"
|
||||
$_
|
||||
exit 1
|
||||
Write-Host "Downloading $Name..."
|
||||
(New-Object System.Net.WebClient).DownloadFile($Url, $FilePath)
|
||||
break
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Host "There is an error during $Name downloading"
|
||||
$_
|
||||
|
||||
Write-Host "Waiting 30 seconds before retrying. Retries left: $retries"
|
||||
Start-Sleep -Seconds 30
|
||||
$retries--
|
||||
|
||||
if ($retries -eq 0)
|
||||
{
|
||||
Write-Host "File can't be downloaded"
|
||||
$_
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "Waiting 30 seconds before retrying. Retries left: $retries"
|
||||
Start-Sleep -Seconds 30
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$ArgumentList = ('/quiet', $FilePath)
|
||||
$ArgumentList = ('/quiet', "`"$FilePath`"")
|
||||
|
||||
Write-Host "Starting Install $Name..."
|
||||
try
|
||||
{
|
||||
$process = Start-Process -FilePath "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\VSIXInstaller.exe" -ArgumentList $ArgumentList -Wait -PassThru
|
||||
#There are 2 types of packages at the moment - exe and vsix
|
||||
if ($Name -match "vsix")
|
||||
{
|
||||
$process = Start-Process -FilePath "C:\Program Files (x86)\Microsoft Visual Studio\$VSversion\Enterprise\Common7\IDE\VSIXInstaller.exe" -ArgumentList $ArgumentList -Wait -PassThru
|
||||
}
|
||||
else
|
||||
{
|
||||
$process = Start-Process -FilePath ${env:Temp}\$Name /Q -Wait -PassThru
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -225,11 +241,14 @@ function Install-VsixExtension
|
||||
exit 1
|
||||
}
|
||||
|
||||
#Cleanup installation files
|
||||
Remove-Item -Force -Confirm:$false $FilePath
|
||||
#Cleanup downloaded installation files
|
||||
if (!$InstallOnly)
|
||||
{
|
||||
Remove-Item -Force -Confirm:$false $FilePath
|
||||
}
|
||||
}
|
||||
|
||||
function Get-VS19ExtensionVersion
|
||||
function Get-VSExtensionVersion
|
||||
{
|
||||
param (
|
||||
[string] [Parameter(Mandatory=$true)] $packageName
|
||||
@@ -255,3 +274,18 @@ function Get-VS19ExtensionVersion
|
||||
|
||||
return $packageVersion
|
||||
}
|
||||
|
||||
function Get-WinVersion
|
||||
{
|
||||
(Get-WmiObject -class Win32_OperatingSystem).Caption
|
||||
}
|
||||
|
||||
function Test-IsWin19
|
||||
{
|
||||
(Get-WinVersion) -match "2019"
|
||||
}
|
||||
|
||||
function Test-IsWin16
|
||||
{
|
||||
(Get-WinVersion) -match "2016"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user