MSI: update path with proper value (#6441)

MSI: update path with proper value
- Add verification that path is updated
This commit is contained in:
Travis Plunk
2018-03-21 12:23:24 -07:00
committed by GitHub
parent ceef2e37e9
commit 1730d8c496
2 changed files with 20 additions and 1 deletions
+1 -1
View File
@@ -165,7 +165,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">
<Environment Id="PATH" Action="set" Name="PATH" Part="last" Permanent="no" System="yes" Value="[$(var.ProductVersionWithName)]"/>
<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.
See https://blogs.msdn.microsoft.com/andrew_richards/2017/03/01/enhancing-the-open-command-prompt-here-shift-right-click-context-menu-experience/ for details -->
+19
View File
@@ -486,6 +486,16 @@ 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*'})
foreach($pathPart in $beforePath)
{
Write-Log "Found existing PowerShell path: $pathPart"
}
# Smoke Test MSI installer
Write-Log "Smoke-Testing MSI installer"
$msi = $artifacts | Where-Object { $_.EndsWith(".msi")}
@@ -499,6 +509,15 @@ function Invoke-AppveyorFinish
}
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"
}
# only publish assembly nuget packages if it is a daily build and tests passed
if((Test-DailyBuild) -and $env:TestPassed -eq 'True')
{