Skip to content

Commit

Permalink
MSI: update path with proper value (PowerShell#6441)
Browse files Browse the repository at this point in the history
MSI: update path with proper value
- Add verification that path is updated
  • Loading branch information
TravisEz13 authored Mar 21, 2018
1 parent ceef2e3 commit 1730d8c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion assets/Product.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -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 -->
Expand Down
19 changes: 19 additions & 0 deletions tools/appveyor.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -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")}
Expand All @@ -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')
{
Expand Down

0 comments on commit 1730d8c

Please sign in to comment.