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:
Mikhail Timofeev
2020-03-16 17:28:46 +00:00
committed by GitHub
parent 7584c7b879
commit bbaf8b9224
18 changed files with 167 additions and 324 deletions

View File

@@ -213,7 +213,7 @@
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Windows2016/Install-Wix.ps1"
"{{ template_dir }}/scripts/Installers/Install-Wix.ps1"
]
},
{
@@ -229,7 +229,7 @@
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Windows2016/Install-WDK.ps1"
"{{ template_dir }}/scripts/Installers/Install-WDK.ps1"
]
},
{
@@ -251,7 +251,7 @@
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Windows2016/Validate-Wix.ps1"
"{{ template_dir }}/scripts/Installers/Validate-Wix.ps1"
]
},
{
@@ -263,7 +263,7 @@
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Windows2016/Validate-WDK.ps1"
"{{ template_dir }}/scripts/Installers/Validate-WDK.ps1"
]
},
{

View File

@@ -188,13 +188,13 @@
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Windows2019/Install-Wix.ps1"
"{{ template_dir }}/scripts/Installers/Install-Wix.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Windows2019/Install-AnalysisExtenstion.ps1"
"{{ template_dir }}/scripts/Installers/Windows2019/Install-SSDTExtensions.ps1"
]
},
{
@@ -210,7 +210,7 @@
{
"type": "powershell",
"scripts": [
"{{ template_dir }}/scripts/Installers/Windows2019/Install-WDK.ps1"
"{{ template_dir }}/scripts/Installers/Install-WDK.ps1"
]
},
{
@@ -226,13 +226,13 @@
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Windows2019/Validate-Wix.ps1"
"{{ template_dir }}/scripts/Installers/Validate-Wix.ps1"
]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Windows2019/Validate-AnalysisExtenstion.ps1"
"{{ template_dir }}/scripts/Installers/Windows2019/Validate-SSDTExtensions.ps1"
]
},
{
@@ -244,7 +244,7 @@
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Windows2019/Validate-WDK.ps1"
"{{ template_dir }}/scripts/Installers/Validate-WDK.ps1"
]
},
{

View File

@@ -19,5 +19,8 @@ Export-ModuleMember -Function @(
'Stop-SvcWithErrHandling'
'Set-SvcWithErrHandling'
'Install-VsixExtension'
'Get-VS19ExtensionVersion'
'Get-VSExtensionVersion'
'Get-WinVersion'
'Test-IsWin19'
'Test-IsWin16'
)

View File

@@ -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"
}

View File

@@ -4,8 +4,24 @@
################################################################################
# Requires Windows SDK with the same version number as the WDK
$winSdkUrl = "https://go.microsoft.com/fwlink/p/?linkid=2083338"
$wdkUrl = "https://go.microsoft.com/fwlink/?linkid=2085767"
Import-Module -Name ImageHelpers -Force
if(Test-IsWin19)
{
$winSdkUrl = "https://go.microsoft.com/fwlink/p/?linkid=2083338"
$wdkUrl = "https://go.microsoft.com/fwlink/?linkid=2085767"
$FilePath = "C:\Program Files (x86)\Windows Kits\10\Vsix\VS2019\WDK.vsix"
$VSver = "2019"
}
else
{
$winSdkUrl = "https://go.microsoft.com/fwlink/p/?LinkID=2023014"
$wdkUrl = "https://go.microsoft.com/fwlink/?linkid=2026156"
$FilePath = "C:\Program Files (x86)\Windows Kits\10\Vsix\WDK.vsix"
$VSver = "2017"
}
# `winsdksetup.exe /features + /quiet` installs all features without showing the GUI
$sdkExitCode = Install-EXE -Url $winSdkUrl -Name "winsdksetup.exe" -ArgumentList ("/features", "+", "/quiet")
@@ -26,32 +42,4 @@ if ($wdkExitCode -ne 0)
}
# Need to install the VSIX to get the build targets when running VSBuild
# Write-Host "Installing WDK.vsix"
try
{
$process = Start-Process `
-FilePath "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\VSIXInstaller.exe" `
-ArgumentList ("/quiet", '"C:\Program Files (x86)\Windows Kits\10\Vsix\VS2019\WDK.vsix"') `
-Wait `
-PassThru
}
catch
{
Write-Host "There is an error during WDK.vsix installation"
$_
exit 1
}
$exitCode = $process.ExitCode
if ($exitCode -eq 0 -or $exitCode -eq 1001) # 1001 means the extension is already installed
{
Write-Host "WDK.vsix installed successfully"
}
else
{
Write-Host "Unsuccessful exit code returned by the installation process: $exitCode."
}
exit $exitCode
Install-VsixExtension -FilePath $FilePath -Name "WDK.vsix" -VSversion $VSver -InstallOnly

View File

@@ -0,0 +1,23 @@
################################################################################
## File: Install-Wix.ps1
## Desc: Install WIX.
################################################################################
Import-Module -Name ImageHelpers -Force;
choco install wixtoolset -y --force
if(Test-IsWin19)
{
$extensionUrl = "https://wixtoolset.gallerycdn.vsassets.io/extensions/wixtoolset/wixtoolsetvisualstudio2019extension/1.0.0.4/1563296438961/Votive2019.vsix"
$VSver = "2019"
}
else
{
$extensionUrl = "https://robmensching.gallerycdn.vsassets.io/extensions/robmensching/wixtoolsetvisualstudio2017extension/0.9.21.62588/1494013210879/250616/4/Votive2017.vsix"
$VSver = "2017"
}
$extensionName = "Votive$VSver.vsix"
#Installing VS extension 'Wix Toolset Visual Studio Extension'
Install-VsixExtension -Url $extensionUrl -Name $extensionName -VSversion $VSver

View File

@@ -19,7 +19,7 @@ function Get-WDKVersion
}
$WDKVersion = Get-WDKVersion
$WDKPackageVersion = Get-VS19ExtensionVersion -packageName "Microsoft.Windows.DriverKit"
$WDKPackageVersion = Get-VSExtensionVersion -packageName "Microsoft.Windows.DriverKit"
# Adding description of the software to Markdown
$SoftwareName = "Windows Driver Kit"

View File

@@ -4,6 +4,7 @@
################################################################################
Import-Module -Name ImageHelpers -Force
function Get-WixVersion {
$regKey = "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*"
$installedApplications = Get-ItemProperty -Path $regKey
@@ -21,14 +22,23 @@ else {
exit 1
}
$WixPackageVersion = Get-VS19ExtensionVersion -packageName "WixToolset.VisualStudioExtension.Dev16"
if(Test-IsWin19)
{
$WixPackageVersion = Get-VSExtensionVersion -packageName "WixToolset.VisualStudioExtension.Dev16"
$VSver = "2019"
}
else
{
$WixPackageVersion = Get-VSExtensionVersion -packageName "WixToolset.VisualStudioExtension.Dev15"
$VSver = "2017"
}
# Adding description of the software to Markdown
$SoftwareName = "WIX Tools"
$Description = @"
_Toolset Version:_ $WixToolSetVersion<br/>
_WIX Toolset Visual Studio Extension Version:_ $WixPackageVersion<br/>
_WIX Toolset Studio $VSver Extension Version:_ $WixPackageVersion<br/>
_Environment:_
* WIX: Installation root of WIX
"@

View File

@@ -1,51 +0,0 @@
################################################################################
## File: Install-WDK.ps1
## Desc: Install the Windows Driver Kit
################################################################################
# Version: 10.0.17763.0
# Update Validate-WDK.ps1 if the version changes!
# There doesn't seem to be any way to check the version programmatically
# Requires Windows SDK with the same version number as the WDK
$winSdkUrl = "https://go.microsoft.com/fwlink/p/?LinkID=2023014"
$wdkUrl = "https://go.microsoft.com/fwlink/?linkid=2026156"
# `winsdksetup.exe /features + /quiet` installs all features without showing the GUI
$sdkExitCode = Install-EXE -Url $winSdkUrl -Name "winsdksetup.exe" -ArgumentList ("/features", "+", "/quiet")
if ($sdkExitCode -ne 0)
{
Write-Host "Failed to install the Windows SDK."
exit $sdkExitCode
}
# `wdksetup.exe /features + /quiet` installs all features without showing the GUI
$wdkExitCode = Install-EXE -Url $wdkUrl -Name "wdksetup.exe" -ArgumentList ("/features", "+", "/quiet")
if ($wdkExitCode -ne 0)
{
Write-Host "Failed to install the Windows Driver Kit."
exit $wdkExitCode
}
# Need to install the VSIX to get the build targets when running VSBuild
Write-Host "Installing WDK.vsix"
$process = Start-Process `
-FilePath "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VSIXInstaller.exe" `
-ArgumentList ("/quiet", '"C:\Program Files (x86)\Windows Kits\10\Vsix\WDK.vsix"') `
-Wait `
-PassThru
$exitCode = $process.ExitCode
if ($exitCode -eq 0 -or $exitCode -eq 1001) # 1001 means the extension is already installed
{
Write-Host "WDK.vsix installed successfully"
}
else
{
Write-Host "Unsuccessful exit code returned by the installation process: $exitCode."
}
exit $exitCode

View File

@@ -1,53 +0,0 @@
################################################################################
## File: Install-Wix.ps1
## Desc: Install WIX.
################################################################################
function Install-VsixExtension
{
Param
(
[String]$Url,
[String]$Name
)
$exitCode = -1
try
{
Write-Host "Downloading $Name..."
$FilePath = "${env:Temp}\$Name"
Invoke-WebRequest -Uri $Url -OutFile $FilePath
$ArgumentList = ('/quiet', $FilePath)
Write-Host "Starting Install $Name..."
$process = Start-Process -FilePath 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VSIXInstaller.exe' -ArgumentList $ArgumentList -Wait -PassThru
$exitCode = $process.ExitCode
if ($exitCode -eq 0 -or $exitCode -eq 3010)
{
Write-Host -Object 'Installation successful'
return $exitCode
}
else
{
Write-Host -Object "Non zero exit code returned by the installation process : $exitCode."
return $exitCode
}
}
catch
{
Write-Host -Object "Failed to install the Extension $Name"
Write-Host -Object $_.Exception.Message
return -1
}
}
choco install wixtoolset -y --force
#Installing VS extension 'Wix Toolset Visual Studio 2017 Extension'
$exitCode = Install-VsixExtension -Url 'https://robmensching.gallerycdn.vsassets.io/extensions/robmensching/wixtoolsetvisualstudio2017extension/0.9.21.62588/1494013210879/250616/4/Votive2017.vsix' -Name 'Votive2017.vsix'
return $exitCode

View File

@@ -5,39 +5,13 @@
Import-Module -Name ImageHelpers -Force
function Get-SSDTExtensionPackage {
$vsProgramData = Get-Item -Path "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances"
$instanceFolders = Get-ChildItem -Path $vsProgramData.FullName
if($instanceFolders -is [array])
{
Write-Host "More than one instance installed"
exit 1
}
$stateContent = Get-Content -Path ($instanceFolders.FullName + '\state.packages.json')
$state = $stateContent | ConvertFrom-Json
$SsdtPackage = $state.packages | where { $_.id -eq "SSDT" }
return $SsdtPackage
}
$SsdtPackage = Get-SSDTExtensionPackage
if($SsdtPackage){
Write-Host "SSDT version" $SsdtPackage.version "installed"
}
else {
Write-Host "SSDT is not installed"
exit 1
}
$SSDTPackageVersion = Get-VSExtensionVersion -packageName "SSDT"
# Adding description of the software to Markdown
$SoftwareName = "SQL Server Data Tools for VS 2017"
$Description = @"
_Version:_ $($SsdtPackage.version)<br/>
_Version:_ $SSDTPackageVersion<br/>
The following components are installed:

View File

@@ -1,13 +0,0 @@
################################################################################
## File: Validate-WDK.ps1
## Desc: Validate the installation of the Windows Driver Kit
################################################################################
# Adding description of the software to Markdown
$SoftwareName = "Windows Driver Kit"
$Description = @"
_Version:_ 10.0.17763.0<br/>
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -1,62 +0,0 @@
################################################################################
## File: Validate-Wix.ps1
## Desc: Validate WIX.
################################################################################
Import-Module -Name ImageHelpers -Force
function Get-WixVersion {
$regKey = "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*"
$installedApplications = Get-ItemProperty -Path $regKey
$Version = ($installedApplications | Where-Object { $_.DisplayName -and $_.DisplayName.toLower().Contains("wix") } | Select-Object -First 1).DisplayVersion
return $Version
}
#Gets the extension details from state.json
function Get-WixExtensionPackage {
$vsProgramData = Get-Item -Path "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances"
$instanceFolders = Get-ChildItem -Path $vsProgramData.FullName
if($instanceFolders -is [array])
{
Write-Host "More than one instance installed"
exit 1
}
$stateContent = Get-Content -Path ($instanceFolders.FullName + '\state.packages.json')
$state = $stateContent | ConvertFrom-Json
$WixPackage = $state.packages | where { $_.id -eq "WixToolset.VisualStudioExtension.Dev15" }
return $WixPackage
}
$WixToolSetVersion = Get-WixVersion
if($WixToolSetVersion) {
Write-Host "Wix Toolset version" $WixPackage.version "installed"
}
else {
Write-Host "Wix Toolset is not installed"
exit 1
}
$WixPackage = Get-WixExtensionPackage
if($WixPackage) {
Write-Host "Wix Extension version" $WixPackage.version "installed"
}
else {
Write-Host "Wix Extension is not installed"
exit 1
}
# Adding description of the software to Markdown
$SoftwareName = "WIX Tools"
$Description = @"
_Toolset Version:_ $WixToolSetVersion<br/>
_WIX Toolset Studio 2017 Extension Version:_ $($WixPackage.version)<br/>
_Environment:_
* WIX: Installation root of WIX
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -1,11 +0,0 @@
###################################################################################
## File: Install-AnalysisExtenstion.ps1
## Desc: Install the Microsoft Analysis Services Projects Visual Studio extension
###################################################################################
Import-Module -Name ImageHelpers -Force;
$extensionUrl = "https://marketplace.visualstudio.com/_apis/public/gallery/publishers/ProBITools/vsextensions/MicrosoftAnalysisServicesModelingProjects/2.9.5/vspackage"
$extensionName = "Microsoft.DataTools.AnalysisServices.vsix"
Install-VsixExtension -Url $extensionUrl -Name $extensionName

View File

@@ -0,0 +1,11 @@
###################################################################################
## File: Install-SSDTExtensions.ps1
## Desc: Install the extensions previously known as SSDT package
###################################################################################
Import-Module -Name ImageHelpers -Force
Install-VsixExtension -Url 'https://marketplace.visualstudio.com/_apis/public/gallery/publishers/ProBITools/vsextensions/MicrosoftAnalysisServicesModelingProjects/2.9.5/vspackage' -Name 'Microsoft.DataTools.AnalysisServices.vsix' -VSversion "2019"
Install-VsixExtension -Url 'https://marketplace.visualstudio.com/_apis/public/gallery/publishers/SSIS/vsextensions/SqlServerIntegrationServicesProjects/3.4/vspackage' -Name 'Microsoft.DataTools.IntegrationServices.exe' -VSversion "2019"
Install-VsixExtension -Url 'https://marketplace.visualstudio.com/_apis/public/gallery/publishers/ProBITools/vsextensions/MicrosoftReportProjectsforVisualStudio/2.6.3/vspackage' -Name 'Microsoft.DataTools.ReportingServices.vsix' -VSversion "2019"

View File

@@ -1,14 +0,0 @@
################################################################################
## File: Install-Wix.ps1
## Desc: Install WIX.
################################################################################
Import-Module -Name ImageHelpers -Force;
choco install wixtoolset -y --force
$extensionUrl = "https://wixtoolset.gallerycdn.vsassets.io/extensions/wixtoolset/wixtoolsetvisualstudio2019extension/1.0.0.4/1563296438961/Votive2019.vsix"
$extensionName = "Votive2019.vsix"
#Installing VS extension 'Wix Toolset Visual Studio 2019 Extension'
Install-VsixExtension -Url $extensionUrl -Name $extensionName

View File

@@ -1,18 +0,0 @@
################################################################################
## File: Validate-AnalysisExtenstion.ps1
## Desc: Validate Microsoft Analysis Services Projects Visual Studio extension
################################################################################
Import-Module -Name ImageHelpers -Force
#AnalysisPackage doesn't have any proper name in the state.packages.json file, only id is available
$AnalysisPackageVersion = Get-VS19ExtensionVersion -packageName "04a86fc2-dbd5-4222-848e-911638e487fe"
# Adding description of the software to Markdown
$SoftwareName = "Microsoft Analysis Services Projects Visual Studio Extension"
$Description = @"
_Version:_ $AnalysisPackageVersion<br/>
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -0,0 +1,22 @@
################################################################################
## File: Validate-SSDTExtensions.ps1
## Desc: Validate SQL Server Data Tools Visual Studio extensions
################################################################################
Import-Module -Name ImageHelpers -Force
#These extensions don't have any proper name in the state.packages.json file, only id is available, which can be found on extension marketplace download page
$AnalysisPackageVersion = Get-VSExtensionVersion -packageName "04a86fc2-dbd5-4222-848e-911638e487fe"
$IntegrationPackageVersion = Get-VSExtensionVersion -packageName "851E7A09-7B2B-4F06-A15D-BABFCB26B970"
$ReportingPackageVersion = Get-VSExtensionVersion -packageName "717ad572-c4b7-435c-c166-c2969777f718"
# Adding description of the software to Markdown
$SoftwareName = "Microsoft SSDT Visual Studio 2019 Extensions"
$Description = @"
_Microsoft Analysis Services Projects Version:_ $AnalysisPackageVersion<br/>
_SQL Server Integration Services Projects Version:_ $IntegrationPackageVersion<br/>
_Microsoft Reporting Services Projects Version:_ $ReportingPackageVersion<br/>
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description