From 4df703616ae7f3fe2e11484702dbc84b89c21a52 Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Fri, 27 Oct 2017 12:52:08 +0800 Subject: [PATCH] use rcedit to embed icon and version information into pwsh.exe (#5178) pwsh.exe today doesn't contain file version information and the icon is only associated with the shortcut file and not the exe Fix is to use rcedit to embed: icon product version file version product name copyright Fix #2883 Fix #5166 Fix #5034 --- build.psm1 | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/build.psm1 b/build.psm1 index 43124942bb..435fe63bbb 100644 --- a/build.psm1 +++ b/build.psm1 @@ -1442,6 +1442,15 @@ function Start-PSBootstrap { # Install Windows dependencies if `-Package` or `-BuildWindowsNative` is specified if ($Environment.IsWindows) { + ## need RCEdit to modify the binaries embedded resources + if (-not (Test-Path "~/.rcedit/rcedit-x64.exe")) + { + log "Install RCEdit for modifying exe resources" + $rceditUrl = "https://github.com/electron/rcedit/releases/download/v1.0.0/rcedit-x64.exe" + New-Item -Path "~/.rcedit" -Type Directory -Force > $null + Invoke-WebRequest -OutFile "~/.rcedit/rcedit-x64.exe" -Uri $rceditUrl + } + if ($BuildWindowsNative) { log "Install Windows dependencies for building PSRP plugin" @@ -1862,6 +1871,16 @@ function New-MSIPackage [Switch] $Force ) + ## need RCEdit to modify the binaries embedded resources + if (-not (Test-Path "~/.rcedit/rcedit-x64.exe")) + { + throw "RCEdit is required to modify pwsh.exe resources, please run 'Start-PSBootStrap' to install" + } + + Start-NativeExecution { & "~/.rcedit/rcedit-x64.exe" (Get-PSOutput) --set-icon "$AssetsPath\Powershell_black.ico" ` + --set-file-version $ProductVersion --set-product-version $ProductVersion --set-version-string "ProductName" "PowerShell Core 6" ` + --set-version-string "LegalCopyright" "(C) Microsoft Corporation. All Rights Reserved." } | Write-Verbose + ## AppVeyor base image might update the version for Wix. Hence, we should ## not hard code version numbers. $wixToolsetBinPath = "${env:ProgramFiles(x86)}\WiX Toolset *\bin"