[Windows] Add WiX tool for Windows 2022 (#4624)

This commit is contained in:
Nikolay Frolov
2021-11-29 18:54:51 +03:00
committed by GitHub
parent 340b210bd1
commit 884d3e799d
6 changed files with 17 additions and 18 deletions

View File

@@ -15,14 +15,13 @@ elseif (Test-IsWin16)
$extensionUrl = "https://robmensching.gallerycdn.vsassets.io/extensions/robmensching/wixtoolsetvisualstudio2017extension/0.9.21.62588/1494013210879/250616/4/Votive2017.vsix" $extensionUrl = "https://robmensching.gallerycdn.vsassets.io/extensions/robmensching/wixtoolsetvisualstudio2017extension/0.9.21.62588/1494013210879/250616/4/Votive2017.vsix"
$VSver = "2017" $VSver = "2017"
} }
else
if (-not (Test-IsWin22))
{ {
throw "Invalid version of Visual Studio is found. Either 2017 or 2019 are required" $extensionName = "Votive$VSver.vsix"
#Installing VS extension 'Wix Toolset Visual Studio Extension'
Install-VsixExtension -Url $extensionUrl -Name $extensionName -VSversion $VSver
} }
$extensionName = "Votive$VSver.vsix"
#Installing VS extension 'Wix Toolset Visual Studio Extension'
Install-VsixExtension -Url $extensionUrl -Name $extensionName -VSversion $VSver
Invoke-PesterTests -TestFile "Wix" Invoke-PesterTests -TestFile "Wix"

View File

@@ -114,6 +114,7 @@ $toolsList = @(
(Get-VSWhereVersion), (Get-VSWhereVersion),
(Get-SwigVersion), (Get-SwigVersion),
(Get-WinAppDriver), (Get-WinAppDriver),
(Get-WixVersion),
(Get-ZstdVersion), (Get-ZstdVersion),
(Get-YAMLLintVersion) (Get-YAMLLintVersion)
) )

View File

@@ -161,6 +161,12 @@ function Get-WinAppDriver {
return "WinAppDriver $winAppDriverVersion" return "WinAppDriver $winAppDriverVersion"
} }
function Get-WixVersion {
$regKey = "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*"
$installedApplications = Get-ItemProperty -Path $regKey
return ($installedApplications | Where-Object { $_.BundleCachePath -imatch ".*\\WiX\d*\.exe$" } | Select-Object -First 1).DisplayName
}
function Get-ZstdVersion { function Get-ZstdVersion {
$(zstd --version) -match "v(?<version>\d+\.\d+\.\d+)" | Out-Null $(zstd --version) -match "v(?<version>\d+\.\d+\.\d+)" | Out-Null
$zstdVersion = $Matches.Version $zstdVersion = $Matches.Version

View File

@@ -13,12 +13,6 @@ function Get-SDKVersion {
($installedApplications | Where-Object { $_.DisplayName -eq 'Windows SDK' } | Select-Object -First 1).DisplayVersion ($installedApplications | Where-Object { $_.DisplayName -eq 'Windows SDK' } | Select-Object -First 1).DisplayVersion
} }
function Get-WixVersion {
$regKey = "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*"
$installedApplications = Get-ItemProperty -Path $regKey
($installedApplications | Where-Object { $_.DisplayName -match "wix" } | Select-Object -First 1).DisplayVersion
}
function Get-WDKVersion { function Get-WDKVersion {
$regKey = "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*" $regKey = "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*"
$installedApplications = Get-ItemProperty -Path $regKey $installedApplications = Get-ItemProperty -Path $regKey
@@ -68,10 +62,8 @@ function Get-VisualStudioExtensions {
if ((Test-IsWin16) -or (Test-IsWin19)) { if ((Test-IsWin16) -or (Test-IsWin19)) {
# Wix # Wix
$wixPackageVersion = Get-WixVersion
$wixExtensionVersion = ($vsPackages | Where-Object {$_.Id -match 'WixToolset.VisualStudioExtension.Dev' -and $_.type -eq 'vsix'}).Version $wixExtensionVersion = ($vsPackages | Where-Object {$_.Id -match 'WixToolset.VisualStudioExtension.Dev' -and $_.type -eq 'vsix'}).Version
$wixPackages = @( $wixPackages = @(
@{Package = 'WIX Toolset'; Version = $wixPackageVersion}
@{Package = "WIX Toolset Studio $vs Extension"; Version = $wixExtensionVersion} @{Package = "WIX Toolset Studio $vs Extension"; Version = $wixExtensionVersion}
) )

View File

@@ -1,15 +1,15 @@
Describe "Wix" -Skip:(Test-IsWin22) { Describe "Wix" {
BeforeAll { BeforeAll {
$regKey = "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*" $regKey = "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*"
$installedApplications = Get-ItemProperty -Path $regKey $installedApplications = Get-ItemProperty -Path $regKey
$version = ($installedApplications | Where-Object { $_.DisplayName -and $_.DisplayName.toLower().Contains("wix") } | Select-Object -First 1).DisplayVersion $version = ($installedApplications | Where-Object { $_.BundleCachePath -imatch ".*\\WiX\d*\.exe$" } | Select-Object -First 1).DisplayName
} }
It "Wix Toolset version from registry" { It "Wix Toolset version from registry" {
$version | Should -Not -BeNullOrEmpty $version | Should -Not -BeNullOrEmpty
} }
It "Wix Toolset version from system" { It "Wix Toolset version from system" -Skip:(Test-IsWin22) {
if (Test-IsWin19) if (Test-IsWin19)
{ {
$exVersion = Get-VSExtensionVersion -packageName "WixToolset.VisualStudioExtension.Dev16" $exVersion = Get-VSExtensionVersion -packageName "WixToolset.VisualStudioExtension.Dev16"

View File

@@ -168,6 +168,7 @@
{ {
"type": "powershell", "type": "powershell",
"scripts": [ "scripts": [
"{{ template_dir }}/scripts/Installers/Install-Wix.ps1",
"{{ template_dir }}/scripts/Installers/Install-Vsix.ps1", "{{ template_dir }}/scripts/Installers/Install-Vsix.ps1",
"{{ template_dir }}/scripts/Installers/Install-AzureCli.ps1", "{{ template_dir }}/scripts/Installers/Install-AzureCli.ps1",
"{{ template_dir }}/scripts/Installers/Install-AzureDevOpsCli.ps1", "{{ template_dir }}/scripts/Installers/Install-AzureDevOpsCli.ps1",