Skip to content

Commit 0487a1b

Browse files
bergmeisterTravisEz13
authored andcommitted
Disambiguate icon on Windows for preview builds/installers to use Powershell_av_colors and make daily build use Powershell_avatar instead (#7086)
Closes #6317 Using the preview side-by-side with the RTM version is a pain/confusing due to the icons being the same. This makes the preview build (i.e. the embedded icon in `pwsh.exe`) and MSI installer package (shortcut icon and context menu) use the [Powershell_av_colors icon](https://raw.githubusercontent.com/PowerShell/PowerShell/master/assets/Powershell_av_colors.ico) ![image](https://user-images.githubusercontent.com/9250262/41491336-6e354936-70f0-11e8-965e-9b5e83be925b.png) Therefore change the icon of the daily build (which used to use the Powershell_av_colors icon) to [Powershell_avatar](https://raw.githubusercontent.com/PowerShell/PowerShell/master/assets/Powershell_avatar.ico) ![image](https://user-images.githubusercontent.com/9250262/41491346-80f890a0-70f0-11e8-9ab5-bb789454c134.png) This means that people like me who have a shortcut to pwsh of the daily build pinned to the taskbar, probably need to re-pin it to the taskbar to receive all changes (otherwise one will only get the change in the icon of the window) Note: The `Test-IsPreview` method had to be moved to the build module, which is OK because the packaging module has a declared dependency on the build module in its manifest.
1 parent 8489532 commit 0487a1b

File tree

4 files changed

+36
-28
lines changed

4 files changed

+36
-28
lines changed

assets/Product.wxs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
<!-- Properties About The Package -->
3636
<Package Id="*" Keywords="Installer" Platform="$(sys.BUILDARCH)" InstallerVersion="200" Compressed="yes" InstallScope="perMachine" Description="PowerShell package" Comments="PowerShell for every system" />
3737
<!-- Add PowerShell icon for executable -->
38-
<Icon Id="PowerShellExe.ico" SourceFile="assets\Powershell_black.ico" />
38+
<Icon Id="PowerShellExe.ico" SourceFile="$(env.IconPath)" />
3939
<!-- Add PowerShell icon in Add/Remove Programs -->
4040
<Property Id="ARPPRODUCTICON" Value="PowerShellExe.ico" />
4141
<!-- Set properties for add/remove programs -->
@@ -174,44 +174,44 @@
174174
<!-- When clicking on background in Explorer -->
175175
<RegistryKey Root="HKCR" Key="Directory\Background\shell\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)">
176176
<RegistryValue Type="string" Name="MUIVerb" Value="$(var.ExplorerContextMenuDialogText)"/>
177-
<RegistryValue Type="string" Name="Icon" Value="[$(var.ProductDirectoryName)]assets\Powershell_black.ico"/>
177+
<RegistryValue Type="string" Name="Icon" Value="[$(var.ProductDirectoryName)]$(env.IconPath)"/>
178178
<RegistryValue Type="string" Name="ExtendedSubCommandsKey" Value="Directory\ContextMenus\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)"/>
179179
</RegistryKey>
180180
<!-- When clicking on Drive in Explorer -->
181181
<RegistryKey Root="HKCR" Key="Drive\shell\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)">
182182
<RegistryValue Type="string" Name="MUIVerb" Value="$(var.ExplorerContextMenuDialogText)"/>
183-
<RegistryValue Type="string" Name="Icon" Value="[$(var.ProductDirectoryName)]assets\Powershell_black.ico"/>
183+
<RegistryValue Type="string" Name="Icon" Value="[$(var.ProductDirectoryName)]$(env.IconPath)"/>
184184
<RegistryValue Type="string" Name="ExtendedSubCommandsKey" Value="Directory\ContextMenus\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)"/>
185185
</RegistryKey>
186186
<!-- When clicking on Desktop background in Explorer -->
187187
<RegistryKey Root="HKCR" Key="DesktopBackground\shell\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)">
188188
<RegistryValue Type="string" Name="MUIVerb" Value="$(var.ExplorerContextMenuDialogText)"/>
189-
<RegistryValue Type="string" Name="Icon" Value="[$(var.ProductDirectoryName)]assets\Powershell_black.ico"/>
189+
<RegistryValue Type="string" Name="Icon" Value="[$(var.ProductDirectoryName)]$(env.IconPath)"/>
190190
<RegistryValue Type="string" Name="ExtendedSubCommandsKey" Value="Directory\ContextMenus\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)"/>
191191
</RegistryKey>
192192
<!-- When clicking on folder in Explorer -->
193193
<RegistryKey Root="HKCR" Key="Directory\shell\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)">
194194
<RegistryValue Type="string" Name="MUIVerb" Value="$(var.ExplorerContextMenuDialogText)"/>
195-
<RegistryValue Type="string" Name="Icon" Value="[$(var.ProductDirectoryName)]assets\Powershell_black.ico"/>
195+
<RegistryValue Type="string" Name="Icon" Value="[$(var.ProductDirectoryName)]$(env.IconPath)"/>
196196
<RegistryValue Type="string" Name="ExtendedSubCommandsKey" Value="Directory\ContextMenus\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)"/>
197197
</RegistryKey>
198198
<!-- When being in a Library folder in Explorer -->
199199
<RegistryKey Root="HKCR" Key="LibraryFolder\background\shell\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)">
200200
<RegistryValue Type="string" Name="MUIVerb" Value="$(var.ExplorerContextMenuDialogText)"/>
201-
<RegistryValue Type="string" Name="Icon" Value="[$(var.ProductDirectoryName)]assets\Powershell_black.ico"/>
201+
<RegistryValue Type="string" Name="Icon" Value="[$(var.ProductDirectoryName)]$(env.IconPath)"/>
202202
<RegistryValue Type="string" Name="ExtendedSubCommandsKey" Value="Directory\ContextMenus\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)"/>
203203
</RegistryKey>
204204
<!-- Sub menus to open PowerShell at the current location either as a normal shell or as Administrator -->
205205
<RegistryKey Root="HKCR" Key="Directory\ContextMenus\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)\shell\open">
206206
<RegistryValue Type="string" Name="MUIVerb" Value="$(var.ExplorerContextSubMenuDialogText)"/>
207-
<RegistryValue Type="string" Name="Icon" Value="[$(var.ProductDirectoryName)]assets\Powershell_black.ico"/>
207+
<RegistryValue Type="string" Name="Icon" Value="[$(var.ProductDirectoryName)]$(env.IconPath)"/>
208208
</RegistryKey>
209209
<RegistryKey Root="HKCR" Key="Directory\ContextMenus\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)\shell\open\command">
210210
<RegistryValue Type="string" Value="[$(var.ProductDirectoryName)]pwsh.exe -NoExit -WorkingDirectory &quot;%V&quot; "/>
211211
</RegistryKey>
212212
<RegistryKey Root="HKCR" Key="Directory\ContextMenus\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)\shell\runas">
213213
<RegistryValue Type="string" Name="MUIVerb" Value="$(var.ExplorerContextSubMenuElevatedDialogText)"/>
214-
<RegistryValue Type="string" Name="Icon" Value="[$(var.ProductDirectoryName)]assets\Powershell_black.ico"/>
214+
<RegistryValue Type="string" Name="Icon" Value="[$(var.ProductDirectoryName)]$(env.IconPath)"/>
215215
<RegistryValue Type="string" Value="" Name="HasLUAShield"/>
216216
</RegistryKey>
217217
<RegistryKey Root="HKCR" Key="Directory\ContextMenus\$(var.ProductName)$(var.SimpleProductVersion)$(sys.BUILDARCH)\shell\runas\command">

build.psm1

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,24 @@ function Start-BuildNativeUnixBinaries {
379379
}
380380
}
381381

382+
<#
383+
.Synopsis
384+
Tests if a version is preview
385+
.EXAMPLE
386+
Test-IsPreview -version '6.1.0-sometthing' # returns true
387+
Test-IsPreview -version '6.1.0' # returns false
388+
#>
389+
function Test-IsPreview
390+
{
391+
param(
392+
[parameter(Mandatory)]
393+
[string]
394+
$Version
395+
)
396+
397+
return $Version -like '*-*'
398+
}
399+
382400
function Start-PSBuild {
383401
[CmdletBinding()]
384402
param(
@@ -612,7 +630,13 @@ Fix steps:
612630
$pwshPath = Join-Path $Options.Output "pwsh.exe"
613631
}
614632

615-
Start-NativeExecution { & "~/.rcedit/rcedit-x64.exe" $pwshPath --set-icon "$PSScriptRoot\assets\Powershell_black.ico" `
633+
if (Test-IsPreview $ReleaseVersion) {
634+
$iconPath = "$PSScriptRoot\assets\Powershell_av_colors.ico"
635+
} else {
636+
$iconPath = "$PSScriptRoot\assets\Powershell_black.ico"
637+
}
638+
639+
Start-NativeExecution { & "~/.rcedit/rcedit-x64.exe" $pwshPath --set-icon $iconPath `
616640
--set-file-version $fileVersion --set-product-version $ReleaseVersion --set-version-string "ProductName" "PowerShell Core 6" `
617641
--set-version-string "LegalCopyright" "(C) Microsoft Corporation. All Rights Reserved." `
618642
--application-manifest "$PSScriptRoot\assets\pwsh.manifest" } | Write-Verbose

tools/install-powershell.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ try {
174174
}
175175

176176
Write-Verbose "Change icon to disambiguate it from a released installation" -Verbose
177-
& "~/.rcedit/rcedit-x64.exe" "$Destination\pwsh.exe" --set-icon "$Destination\assets\Powershell_av_colors.ico"
177+
& "~/.rcedit/rcedit-x64.exe" "$Destination\pwsh.exe" --set-icon "$Destination\assets\Powershell_avatar.ico"
178178
}
179179

180180
## Change the mode of 'pwsh' to 'rwxr-xr-x' to allow execution

tools/packaging/packaging.psm1

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2279,24 +2279,6 @@ function New-MSIPatch
22792279
Remove-Item -Path $filesToCleanup -Force -Recurse -ErrorAction SilentlyContinue
22802280
}
22812281

2282-
<#
2283-
.Synopsis
2284-
Tests if a version is preview
2285-
.EXAMPLE
2286-
Test-IsPreview -version '6.1.0-sometthing' # returns true
2287-
Test-IsPreview -version '6.1.0' # returns false
2288-
#>
2289-
function Test-IsPreview
2290-
{
2291-
param(
2292-
[parameter(Mandatory)]
2293-
[string]
2294-
$Version
2295-
)
2296-
2297-
return $Version -like '*-*'
2298-
}
2299-
23002282
<#
23012283
.Synopsis
23022284
Creates a Windows installer MSI package and assumes that the binaries are already built using 'Start-PSBuild'.
@@ -2402,12 +2384,14 @@ function New-MSIPackage
24022384
[Environment]::SetEnvironmentVariable("AddPathDefault", '1', "Process")
24032385
[Environment]::SetEnvironmentVariable("UpgradeCodeX64", '31ab5147-9a97-4452-8443-d9709f0516e1', "Process")
24042386
[Environment]::SetEnvironmentVariable("UpgradeCodeX86", '1d00683b-0f84-4db8-a64f-2f98ad42fe06', "Process")
2387+
[Environment]::SetEnvironmentVariable("IconPath", 'assets\Powershell_black.ico', "Process")
24052388
}
24062389
else
24072390
{
24082391
[Environment]::SetEnvironmentVariable("AddPathDefault", '0', "Process")
24092392
[Environment]::SetEnvironmentVariable("UpgradeCodeX64", '39243d76-adaf-42b1-94fb-16ecf83237c8', "Process")
24102393
[Environment]::SetEnvironmentVariable("UpgradeCodeX86", '86abcfbd-1ccc-4a88-b8b2-0facfde29094', "Process")
2394+
[Environment]::SetEnvironmentVariable("IconPath", 'assets\Powershell_av_colors.ico', "Process")
24112395
}
24122396
$fileArchitecture = 'amd64'
24132397
$ProductProgFilesDir = "ProgramFiles64Folder"

0 commit comments

Comments
 (0)