mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Simplify the paths the MSI uses (#6442)
- Implementation of PowerShell/PowerShell-RFC#115 (If anything changes in the RFC, we will treat it as a bug, and fix it later) - Update registry and directory paths to use 6 for the version for stable and 6-preview for a preview release - Add checkbox to set path - default checkbox to off for preview builds and on for stable builds
This commit is contained in:
+28
-26
@@ -6,29 +6,28 @@
|
||||
<?define InfoURL="https://github.com/PowerShell/PowerShell" ?>
|
||||
<?define ProductName = "$(env.ProductName)" ?>
|
||||
<?define ProductCode = "$(env.ProductCode)" ?>
|
||||
<?define ProductSimpleVersionWithNameAndOptionalArchitecture = "$(var.ProductName) $(env.SimpleProductVersion) ($(sys.BUILDARCH))"?>
|
||||
<!-- UpgradeCode GUID MUST REMAIN SAME THROUGHOUT ALL VERSIONS, otherwise, updates won't occur. -->
|
||||
<?if $(sys.BUILDARCH)=x64?>
|
||||
<?define UpgradeCode = "$(env.UpgradeCodeX64)" ?>
|
||||
<?define ProductSemanticVersionWithNameAndOptionalArchitecture = "$(var.ProductName) $(env.ProductSemanticVersion)"?>
|
||||
<?define ExplorerContextMenuDialogText = "&$(var.ProductName) $(env.ProductSemanticVersion)"?>
|
||||
<?define ExplorerContextMenuDialogText = "&$(var.ProductName) $(env.SimpleProductVersion)"?>
|
||||
<?else?>
|
||||
<?define UpgradeCode = "$(env.UpgradeCodeX86)" ?>
|
||||
<?define ProductSemanticVersionWithNameAndOptionalArchitecture = "$(var.ProductName) $(env.ProductSemanticVersion) ($(sys.BUILDARCH))"?>
|
||||
<?define ExplorerContextMenuDialogText = "&$(var.ProductName) $(env.ProductSemanticVersion) ($(sys.BUILDARCH))"?>
|
||||
<?define ExplorerContextMenuDialogText = "&$(var.ProductName) $(env.SimpleProductVersion) ($(sys.BUILDARCH))"?>
|
||||
<?endif?>
|
||||
<?define ProductDirectoryName = "$(env.ProductDirectoryName)" ?>
|
||||
<?define ProductVersion = "$(env.ProductVersion)" ?>
|
||||
<?define SimpleProductVersion = "$(env.SimpleProductVersion)" ?>
|
||||
<?define ProductSemanticVersion = "$(env.ProductSemanticVersion)" ?>
|
||||
<?define ProductVersionWithName = "$(var.ProductName)_$(var.ProductVersion)"?>
|
||||
<?define ProductSemanticVersionWithName = "$(var.ProductName)-$(env.ProductSemanticVersion)"?>
|
||||
<?define ProductProgFilesDir = "$(env.ProductProgFilesDir)" ?>
|
||||
<?define AddPathDefault = "$(env.AddPathDefault)"?>
|
||||
<!-- Explorer context submenu entries. The ampersand denotes the keyboard shortcut. -->
|
||||
<?define ExplorerContextSubMenuDialogText = "Open &here"?>
|
||||
<?define ExplorerContextSubMenuElevatedDialogText = "Open here as &Administrator"?>
|
||||
<!-- The ProductCode is Product Id and needs to be unique for every PowerShell version to allow SxS install: http://wixtoolset.org/documentation/manual/v3/xsd/wix/product.html -->
|
||||
<Product
|
||||
Id="$(var.ProductCode)"
|
||||
Name="PowerShell 6-$(sys.BUILDARCH)"
|
||||
Name="PowerShell $(var.SimpleProductVersion)-$(sys.BUILDARCH)"
|
||||
Language="1033"
|
||||
Version="$(var.ProductVersion)"
|
||||
Manufacturer="Microsoft Corporation"
|
||||
@@ -148,7 +147,7 @@
|
||||
<Directory Id="TARGETDIR" Name="SourceDir">
|
||||
<Directory Id="$(var.ProductProgFilesDir)">
|
||||
<Directory Id="INSTALLFOLDER" Name="PowerShell">
|
||||
<Directory Id="$(var.ProductDirectoryName)" Name="$(var.ProductSemanticVersion)">
|
||||
<Directory Id="$(var.ProductDirectoryName)" Name="$(var.SimpleProductVersion)">
|
||||
<Component Id="ProductVersionFolder" Guid="{e1a7f05e-0cd6-4227-80a8-e4fb311f045c}">
|
||||
<CreateFolder/>
|
||||
</Component>
|
||||
@@ -165,6 +164,7 @@
|
||||
</Component>
|
||||
<!-- add ourselves to %PATH% so pwsh.exe can be started from Windows PowerShell or cmd.exe -->
|
||||
<Component Id="SetPath" Guid="{9dbb7763-7baf-48e7-b025-3bdedcb0632f}" KeyPath="yes">
|
||||
<Condition>ADD_PATH=1</Condition>
|
||||
<Environment Id="PATH" Action="set" Name="PATH" Part="last" Permanent="no" System="yes" Value="[$(var.ProductDirectoryName)]"/>
|
||||
</Component>
|
||||
<!-- Explorer context menu with 2 submenus to open PowerShell normally or as an Administator.
|
||||
@@ -172,43 +172,43 @@
|
||||
<Component Id="ExplorerContextMenu" Guid="{df82e941-fced-4de9-aef8-c81a2946dd68}" KeyPath="yes">
|
||||
<Condition>ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL</Condition>
|
||||
<!-- When clicking on background in Explorer -->
|
||||
<RegistryKey Root="HKCR" Key="Directory\Background\shell\$(var.ProductName)$(env.ProductSemanticVersion)$(sys.BUILDARCH)">
|
||||
<RegistryKey Root="HKCR" Key="Directory\Background\shell\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)">
|
||||
<RegistryValue Type="string" Name="MUIVerb" Value="$(var.ExplorerContextMenuDialogText)"/>
|
||||
<RegistryValue Type="string" Name="Icon" Value="[$(var.ProductDirectoryName)]assets\Powershell_black.ico"/>
|
||||
<RegistryValue Type="string" Name="ExtendedSubCommandsKey" Value="Directory\ContextMenus\$(var.ProductName)$(env.ProductSemanticVersion)$(sys.BUILDARCH)"/>
|
||||
<RegistryValue Type="string" Name="ExtendedSubCommandsKey" Value="Directory\ContextMenus\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)"/>
|
||||
</RegistryKey>
|
||||
<!-- When clicking on Drive in Explorer -->
|
||||
<RegistryKey Root="HKCR" Key="Drive\shell\$(var.ProductName)$(env.ProductSemanticVersion)$(sys.BUILDARCH)">
|
||||
<RegistryKey Root="HKCR" Key="Drive\shell\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)">
|
||||
<RegistryValue Type="string" Name="MUIVerb" Value="$(var.ExplorerContextMenuDialogText)"/>
|
||||
<RegistryValue Type="string" Name="Icon" Value="[$(var.ProductDirectoryName)]assets\Powershell_black.ico"/>
|
||||
<RegistryValue Type="string" Name="ExtendedSubCommandsKey" Value="Directory\ContextMenus\$(var.ProductName)$(env.ProductSemanticVersion)$(sys.BUILDARCH)"/>
|
||||
<RegistryValue Type="string" Name="ExtendedSubCommandsKey" Value="Directory\ContextMenus\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)"/>
|
||||
</RegistryKey>
|
||||
<!-- When clicking on Desktop background in Explorer -->
|
||||
<RegistryKey Root="HKCR" Key="DesktopBackground\shell\$(var.ProductName)$(env.ProductSemanticVersion)$(sys.BUILDARCH)">
|
||||
<RegistryKey Root="HKCR" Key="DesktopBackground\shell\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)">
|
||||
<RegistryValue Type="string" Name="MUIVerb" Value="$(var.ExplorerContextMenuDialogText)"/>
|
||||
<RegistryValue Type="string" Name="Icon" Value="[$(var.ProductDirectoryName)]assets\Powershell_black.ico"/>
|
||||
<RegistryValue Type="string" Name="ExtendedSubCommandsKey" Value="Directory\ContextMenus\$(var.ProductName)$(env.ProductSemanticVersion)$(sys.BUILDARCH)"/>
|
||||
<RegistryValue Type="string" Name="ExtendedSubCommandsKey" Value="Directory\ContextMenus\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)"/>
|
||||
</RegistryKey>
|
||||
<!-- When clicking on folder in Explorer -->
|
||||
<RegistryKey Root="HKCR" Key="Directory\shell\$(var.ProductName)$(env.ProductSemanticVersion)$(sys.BUILDARCH)">
|
||||
<RegistryKey Root="HKCR" Key="Directory\shell\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)">
|
||||
<RegistryValue Type="string" Name="MUIVerb" Value="$(var.ExplorerContextMenuDialogText)"/>
|
||||
<RegistryValue Type="string" Name="Icon" Value="[$(var.ProductDirectoryName)]assets\Powershell_black.ico"/>
|
||||
<RegistryValue Type="string" Name="ExtendedSubCommandsKey" Value="Directory\ContextMenus\$(var.ProductName)$(env.ProductSemanticVersion)$(sys.BUILDARCH)"/>
|
||||
<RegistryValue Type="string" Name="ExtendedSubCommandsKey" Value="Directory\ContextMenus\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)"/>
|
||||
</RegistryKey>
|
||||
<!-- Sub menus to open PowerShell at the current location either as a normal shell or as Administrator -->
|
||||
<RegistryKey Root="HKCR" Key="Directory\ContextMenus\$(var.ProductName)$(env.ProductSemanticVersion)$(sys.BUILDARCH)\shell\open">
|
||||
<RegistryKey Root="HKCR" Key="Directory\ContextMenus\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)\shell\open">
|
||||
<RegistryValue Type="string" Name="MUIVerb" Value="$(var.ExplorerContextSubMenuDialogText)"/>
|
||||
<RegistryValue Type="string" Name="Icon" Value="[$(var.ProductDirectoryName)]assets\Powershell_black.ico"/>
|
||||
</RegistryKey>
|
||||
<RegistryKey Root="HKCR" Key="Directory\ContextMenus\$(var.ProductName)$(env.ProductSemanticVersion)$(sys.BUILDARCH)\shell\open\command">
|
||||
<RegistryKey Root="HKCR" Key="Directory\ContextMenus\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)\shell\open\command">
|
||||
<RegistryValue Type="string" Value="[$(var.ProductDirectoryName)]pwsh.exe -NoExit -Command Set-Location -LiteralPath '%V'"/>
|
||||
</RegistryKey>
|
||||
<RegistryKey Root="HKCR" Key="Directory\ContextMenus\$(var.ProductName)$(env.ProductSemanticVersion)$(sys.BUILDARCH)\shell\runas">
|
||||
<RegistryKey Root="HKCR" Key="Directory\ContextMenus\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)\shell\runas">
|
||||
<RegistryValue Type="string" Name="MUIVerb" Value="$(var.ExplorerContextSubMenuElevatedDialogText)"/>
|
||||
<RegistryValue Type="string" Name="Icon" Value="[$(var.ProductDirectoryName)]assets\Powershell_black.ico"/>
|
||||
<RegistryValue Type="string" Value="" Name="HasLUAShield"/>
|
||||
</RegistryKey>
|
||||
<RegistryKey Root="HKCR" Key="Directory\ContextMenus\$(var.ProductName)$(env.ProductSemanticVersion)$(sys.BUILDARCH)\shell\runas\command">
|
||||
<RegistryKey Root="HKCR" Key="Directory\ContextMenus\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)\shell\runas\command">
|
||||
<RegistryValue Type="string" Value="[$(var.ProductDirectoryName)]pwsh.exe -NoExit -Command Set-Location -LiteralPath '%V'"/>
|
||||
</RegistryKey>
|
||||
</Component>
|
||||
@@ -219,14 +219,14 @@
|
||||
<Directory Id="ApplicationProgramsFolder" Name="$(var.ProductName)">
|
||||
<Component Id="ApplicationProgramsMenuShortcut" Guid="{A77507A7-F970-4618-AC30-20AFE36EE2EB}">
|
||||
<Shortcut Id="PowerShell_ProgramsMenuShortcut"
|
||||
Name="$(var.ProductSemanticVersionWithNameAndOptionalArchitecture)"
|
||||
Description="$(var.ProductSemanticVersionWithNameAndOptionalArchitecture)"
|
||||
Name="$(var.ProductSimpleVersionWithNameAndOptionalArchitecture)"
|
||||
Description="$(var.ProductSimpleVersionWithNameAndOptionalArchitecture)"
|
||||
Target="[$(var.ProductDirectoryName)]pwsh.exe"
|
||||
WorkingDirectory="$(var.ProductDirectoryName)"
|
||||
Icon = "PowerShellExe.ico" />
|
||||
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
|
||||
<!-- HKMU is HKLM when installing perMachine and HKCU when installing perUser-->
|
||||
<RegistryValue Root="HKMU" Key="Software\Microsoft\$(var.ProductSemanticVersionWithNameAndOptionalArchitecture)\ProgramsMenuShortcut" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
|
||||
<RegistryValue Root="HKMU" Key="Software\Microsoft\PowerShellCore\ProgramsMenuShortcut\$(var.SimpleProductVersion)" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
|
||||
</Component>
|
||||
</Directory>
|
||||
</Directory>
|
||||
@@ -237,11 +237,13 @@
|
||||
<Fragment>
|
||||
<UI>
|
||||
<Property Id="REGISTER_MANIFEST" Value="1" />
|
||||
<Property Id="ADD_PATH" Value="$(var.AddPathDefault)" />
|
||||
<Dialog Id="ExplorerContextMenuDialog" Width="370" Height="270" Title="!(loc.ExitDialog_Title)">
|
||||
<!-- If the checkboxes are defined first, then they are first in the tab order and can be ticked and unticked using the spacebar -->
|
||||
<Control Id="RegisterManifestCheckBox" Type="CheckBox" X="20" Y="60" Width="290" Height="17" Property="REGISTER_MANIFEST" CheckBoxValue="0" Text="Register Windows Event Logging Manifest"/>
|
||||
<Control Id="EnablePSRemotingCheckBox" Type="CheckBox" X="20" Y="80" Width="290" Height="17" Property="ENABLE_PSREMOTING" CheckBoxValue="0" Text="Enable $(var.ProductName) remoting"/>
|
||||
<Control Id="ContextMenuOpenPowerShell" Type="CheckBox" X="20" Y="100" Width="290" Height="17" Property="ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL" CheckBoxValue="0" Text="Add '$(var.ExplorerContextSubMenuDialogText)' context menus to Explorer"/>
|
||||
<Control Id="AddToPathCheckBox" Type="CheckBox" X="20" Y="60" Width="290" Height="17" Property="ADD_PATH" CheckBoxValue="0" Text="Add $(var.ProductName) to Path Environment Variable"/>
|
||||
<Control Id="RegisterManifestCheckBox" Type="CheckBox" X="20" Y="80" Width="290" Height="17" Property="REGISTER_MANIFEST" CheckBoxValue="0" Text="Register Windows Event Logging Manifest"/>
|
||||
<Control Id="EnablePSRemotingCheckBox" Type="CheckBox" X="20" Y="100" Width="290" Height="17" Property="ENABLE_PSREMOTING" CheckBoxValue="0" Text="Enable $(var.ProductName) remoting"/>
|
||||
<Control Id="ContextMenuOpenPowerShell" Type="CheckBox" X="20" Y="120" Width="290" Height="17" Property="ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL" CheckBoxValue="0" Text="Add '$(var.ExplorerContextSubMenuDialogText)' context menus to Explorer"/>
|
||||
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)"/>
|
||||
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Cancel="yes" Default="yes" Text="!(loc.WixUINext)"/>
|
||||
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
function Test-Elevated {
|
||||
[CmdletBinding()]
|
||||
[OutputType([bool])]
|
||||
Param()
|
||||
|
||||
# if the current Powershell session was called with administrator privileges,
|
||||
# the Administrator Group's well-known SID will show up in the Groups for the current identity.
|
||||
# Note that the SID won't show up unless the process is elevated.
|
||||
return (([Security.Principal.WindowsIdentity]::GetCurrent()).Groups -contains "S-1-5-32-544")
|
||||
}
|
||||
|
||||
function Invoke-Msiexec {
|
||||
param(
|
||||
[Parameter(ParameterSetName = 'Install', Mandatory)]
|
||||
[Switch]$Install,
|
||||
|
||||
[Parameter(ParameterSetName = 'Uninstall', Mandatory)]
|
||||
[Switch]$Uninstall,
|
||||
|
||||
[Parameter(Mandatory)]
|
||||
[ValidateScript({Test-Path -Path $_})]
|
||||
[String]$MsiPath,
|
||||
|
||||
[Parameter(ParameterSetName = 'Install')]
|
||||
[HashTable] $Properties
|
||||
|
||||
)
|
||||
$action = "$($PsCmdlet.ParameterSetName)ing"
|
||||
if ($Install.IsPresent) {
|
||||
$switch = '/I'
|
||||
} else {
|
||||
$switch = '/x'
|
||||
}
|
||||
|
||||
$additionalOptions = @()
|
||||
if ($Properties) {
|
||||
foreach ($key in $Properties.Keys) {
|
||||
$additionalOptions += "$key=$($Properties.$key)"
|
||||
}
|
||||
}
|
||||
|
||||
$argumentList = "$switch $MsiPath /quiet /l*vx $msiLog $additionalOptions"
|
||||
$msiExecProcess = Start-Process msiexec.exe -Wait -ArgumentList $argumentList -NoNewWindow -PassThru
|
||||
if ($msiExecProcess.ExitCode -ne 0) {
|
||||
$exitCode = $msiExecProcess.ExitCode
|
||||
throw "$action MSI failed and returned error code $exitCode."
|
||||
}
|
||||
}
|
||||
|
||||
Describe -Name "Windows MSI" -Fixture {
|
||||
BeforeAll {
|
||||
$msiX64Path = $env:PsMsiX64Path
|
||||
|
||||
# Get any existing powershell core in the path
|
||||
$beforePath = @(([System.Environment]::GetEnvironmentVariable('PATH', 'MACHINE')) -split ';' |
|
||||
Where-Object {$_ -like '*files\powershell*'})
|
||||
|
||||
$msiLog = Join-Path -Path $TestDrive -ChildPath 'msilog.txt'
|
||||
|
||||
foreach ($pathPart in $beforePath) {
|
||||
Write-Warning "Found existing PowerShell path: $pathPart"
|
||||
}
|
||||
|
||||
if (!(Test-Elevated)) {
|
||||
Write-Warning "Tests must be elevated"
|
||||
}
|
||||
$uploadedLog = $false
|
||||
}
|
||||
BeforeEach {
|
||||
$Error.Clear()
|
||||
}
|
||||
AfterEach {
|
||||
if ($Error.Count -ne 0 -and !$uploadedLog) {
|
||||
if ($env:APPVEYOR) {
|
||||
Push-AppveyorArtifact $msiLog
|
||||
} else {
|
||||
Copy-Item -Path $msiLog -Destination $env:temp -Force
|
||||
Write-Verbose "MSI log is at $env:temp\msilog.txt" -Verbose
|
||||
}
|
||||
$uploadedLog = $true
|
||||
}
|
||||
}
|
||||
|
||||
Context "Add Path disabled" {
|
||||
It "MSI should install without error" -Skip:(!(Test-Elevated)) {
|
||||
{
|
||||
Invoke-MsiExec -Install -MsiPath $msiX64Path -Properties @{ADD_PATH = 0}
|
||||
} | Should -Not -Throw
|
||||
}
|
||||
|
||||
It "MSI should have not be updated path" -Skip:(!(Test-Elevated)) {
|
||||
$psPath = ([System.Environment]::GetEnvironmentVariable('PATH', 'MACHINE')) -split ';' |
|
||||
Where-Object {$_ -like '*files\powershell*' -and $_ -notin $beforePath}
|
||||
|
||||
$psPath | Should -BeNullOrEmpty
|
||||
}
|
||||
|
||||
It "MSI should uninstall without error" -Skip:(!(Test-Elevated)) {
|
||||
{
|
||||
Invoke-MsiExec -Uninstall -MsiPath $msiX64Path
|
||||
} | Should -Not -Throw
|
||||
}
|
||||
}
|
||||
|
||||
Context "Add Path enabled" {
|
||||
It "MSI should install without error" -Skip:(!(Test-Elevated)) {
|
||||
{
|
||||
Invoke-MsiExec -Install -MsiPath $msiX64Path -Properties @{ADD_PATH = 1}
|
||||
} | Should -Not -Throw
|
||||
}
|
||||
|
||||
It "MSI should have updated path" -Skip:(!(Test-Elevated)) {
|
||||
$psPath = ([System.Environment]::GetEnvironmentVariable('PATH', 'MACHINE')) -split ';' |
|
||||
Where-Object {$_ -like '*files\powershell*' -and $_ -notin $beforePath}
|
||||
|
||||
$psPath | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
|
||||
It "MSI should uninstall without error" -Skip:(!(Test-Elevated)) {
|
||||
{
|
||||
Invoke-MsiExec -Uninstall -MsiPath $msiX64Path
|
||||
} | Should -Not -Throw
|
||||
}
|
||||
}
|
||||
}
|
||||
+12
-28
@@ -486,36 +486,20 @@ function Invoke-AppveyorFinish
|
||||
$preReleaseVersion = "$previewPrefix-$previewLabel.$env:APPVEYOR_BUILD_NUMBER"
|
||||
}
|
||||
|
||||
# Save any PowerShell paths, so we can exclude them
|
||||
# When we verify we updated the path
|
||||
$beforePath = @(([System.Environment]::GetEnvironmentVariable('PATH','MACHINE')) -split ';' |
|
||||
Where-Object {$_ -like '*files\powershell*'})
|
||||
# the packaging tests find the MSI package using env:PSMsiX64Path
|
||||
$env:PSMsiX64Path = $artifacts | Where-Object { $_.EndsWith(".msi")}
|
||||
|
||||
foreach($pathPart in $beforePath)
|
||||
# Install the latest Pester and import it
|
||||
Install-Module Pester -Force -SkipPublisherCheck
|
||||
Import-Module Pester -Force
|
||||
|
||||
# start the packaging tests and get the results
|
||||
$packagingTestResult = Invoke-Pester -Script (Join-Path $repoRoot '.\test\packaging\windows\') -PassThru
|
||||
|
||||
# fail the CI job if the tests failed, or nothing passed
|
||||
if($packagingTestResult.FailedCount -ne 0 -or !$packagingTestResult.PassedCount)
|
||||
{
|
||||
Write-Log "Found existing PowerShell path: $pathPart"
|
||||
}
|
||||
|
||||
# Smoke Test MSI installer
|
||||
Write-Log "Smoke-Testing MSI installer"
|
||||
$msi = $artifacts | Where-Object { $_.EndsWith(".msi")}
|
||||
$msiLog = Join-Path (Get-Location) 'msilog.txt'
|
||||
$msiExecProcess = Start-Process msiexec.exe -Wait -ArgumentList "/I $msi /quiet /l*vx $msiLog" -NoNewWindow -PassThru
|
||||
if ($msiExecProcess.ExitCode -ne 0)
|
||||
{
|
||||
Push-AppveyorArtifact msiLog.txt
|
||||
$exitCode = $msiExecProcess.ExitCode
|
||||
throw "MSI installer failed and returned error code $exitCode. MSI Log was uploaded as artifact."
|
||||
}
|
||||
Write-Log "MSI smoke test was successful"
|
||||
|
||||
# Verify path was updated by MSI
|
||||
$psPath = ([System.Environment]::GetEnvironmentVariable('PATH','MACHINE')) -split ';' |
|
||||
Where-Object {$_ -like '*files\powershell*' -and $_ -notin $beforePath}
|
||||
|
||||
if(!$psPath)
|
||||
{
|
||||
throw "MSI did not add powershell to path"
|
||||
throw "Packaging tests failed ($($packagingTestResult.FailedCount) failed/$($packagingTestResult.PassedCount) passed)"
|
||||
}
|
||||
|
||||
# only publish assembly nuget packages if it is a daily build and tests passed
|
||||
|
||||
@@ -2280,7 +2280,13 @@ function New-MSIPackage
|
||||
$wixPaths = Get-WixPath
|
||||
|
||||
$ProductSemanticVersion = Get-PackageSemanticVersion -Version $ProductVersion
|
||||
$simpleProductVersion = '6'
|
||||
$isPreview = $ProductSemanticVersion -like '*-*'
|
||||
if($isPreview)
|
||||
{
|
||||
$simpleProductVersion += '-preview'
|
||||
}
|
||||
|
||||
$ProductVersion = Get-PackageVersionAsMajorMinorBuildRevision -Version $ProductVersion
|
||||
|
||||
$assetsInSourcePath = Join-Path $ProductSourcePath 'assets'
|
||||
@@ -2301,15 +2307,18 @@ function New-MSIPackage
|
||||
[Environment]::SetEnvironmentVariable("ProductName", $ProductName, "Process")
|
||||
[Environment]::SetEnvironmentVariable("ProductCode", $ProductCode, "Process")
|
||||
[Environment]::SetEnvironmentVariable("ProductVersion", $ProductVersion, "Process")
|
||||
[Environment]::SetEnvironmentVariable("SimpleProductVersion", $simpleProductVersion, "Process")
|
||||
[Environment]::SetEnvironmentVariable("ProductSemanticVersion", $ProductSemanticVersion, "Process")
|
||||
[Environment]::SetEnvironmentVariable("ProductVersionWithName", $productVersionWithName, "Process")
|
||||
if(!$isPreview)
|
||||
{
|
||||
[Environment]::SetEnvironmentVariable("AddPathDefault", '1', "Process")
|
||||
[Environment]::SetEnvironmentVariable("UpgradeCodeX64", '31ab5147-9a97-4452-8443-d9709f0516e1', "Process")
|
||||
[Environment]::SetEnvironmentVariable("UpgradeCodeX86", '1d00683b-0f84-4db8-a64f-2f98ad42fe06', "Process")
|
||||
}
|
||||
else
|
||||
{
|
||||
[Environment]::SetEnvironmentVariable("AddPathDefault", '0', "Process")
|
||||
[Environment]::SetEnvironmentVariable("UpgradeCodeX64", '39243d76-adaf-42b1-94fb-16ecf83237c8', "Process")
|
||||
[Environment]::SetEnvironmentVariable("UpgradeCodeX86", '86abcfbd-1ccc-4a88-b8b2-0facfde29094', "Process")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user