GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — use rcedit to embed icon and version information into pwsh.exe by SteveL-MSFT · Pull Request #5178 · PowerShell/PowerShell

Conversation

@SteveL-MSFT

@SteveL-MSFT Steve Lee (SteveL-MSFT) commented Oct 20, 2017 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@SteveL-MSFT
use rcedit to embed icon and version information into pwsh.exe
b3c8300
@SteveL-MSFT Steve Lee (SteveL-MSFT) assigned Travis Plunk (TravisEz13) Oct 20, 2017
@SteveL-MSFT
Steve Lee (SteveL-MSFT) requested a review from Travis Plunk (TravisEz13) October 20, 2017 03:42
@SteveL-MSFT
Steve Lee (SteveL-MSFT) requested review from Aditya Patwardhan (adityapatwardhan) and Dongbo Wang (daxian-dbw) as code owners October 20, 2017 03:42
iSazonov
Ilya (iSazonov) reviewed Oct 20, 2017
View reviewed changes
Comment thread build.psm1
)

## need RCEdit to modify the binaries embedded resources
if (-not (Test-Path "~/.rcedit/rcedit-x64.exe"))

@iSazonov Ilya (iSazonov) Oct 20, 2017

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about Unix?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@SteveL-MSFT Steve Lee (SteveL-MSFT) Oct 20, 2017

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not as familiar on non-Windows with regards to viewing resources (which Explorer does easily), is this something I can do easily with Ubuntu? If so, I can move this to the build step rather than packaging.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@SteveL-MSFT Steve Lee (SteveL-MSFT) Oct 20, 2017

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also rcedit only works on Windows

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@iSazonov Ilya (iSazonov) Oct 20, 2017

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get-Item <file> | fl * show ProductVersion on WSL.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@SteveL-MSFT Steve Lee (SteveL-MSFT) Oct 20, 2017

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ilya (@iSazonov) not working for me with WSL:

PS /mnt/c/Windows/System32/WindowsPowerShell/v1.0> get-item ./powershell.exe | fl *


PSPath            : Microsoft.PowerShell.Core\FileSystem::/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe
PSParentPath      : Microsoft.PowerShell.Core\FileSystem::/mnt/c/Windows/System32/WindowsPowerShell/v1.0
PSChildName       : powershell.exe
PSDrive           : /
PSProvider        : Microsoft.PowerShell.Core\FileSystem
PSIsContainer     : False
Mode              : --r--l
VersionInfo       : File:             /mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe
                    InternalName:
                    OriginalFilename:
                    FileVersion:
                    FileDescription:
                    Product:
                    ProductVersion:

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@SteveL-MSFT Steve Lee (SteveL-MSFT) Oct 20, 2017

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like PowerShell is simply using the FileVersionInfo class which doesn't return anything on Linux:

PS /mnt/c/Windows/System32/WindowsPowerShell/v1.0> [System.Diagnostics.FileVersionInfo]::GetVersionInfo("/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe")

ProductVersion   FileVersion      FileName
--------------   -----------      --------
                                  /mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe

but on Windows:

PS C:\Windows\System32\WindowsPowerShell\v1.0> [System.Diagnostics.FileVersionInfo]::GetVersionInfo("C:\Windows\system32
\WindowsPowerShell\v1.0\powershell.exe")

ProductVersion   FileVersion      FileName
--------------   -----------      --------
10.0.17019.1000  10.0.17019.10... C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@SteveL-MSFT Steve Lee (SteveL-MSFT) Oct 20, 2017

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linux ELF binaries probably don't have a resource section to stuff this info into.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@iSazonov Ilya (iSazonov) Oct 21, 2017 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Steve Lee (@SteveL-MSFT) Why you test the Windows FullCLR exe file? In my test I used SMA.dll from PowerShell Core.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@SteveL-MSFT Steve Lee (SteveL-MSFT) Oct 21, 2017

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used Windows PowerShell.exe as I knew that had that info populated. I see that SMA.dll from PSCore6 does have that info as does powershell.exe from PSCore6. So dotnet build is adding that, but the executable doesn't have it.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@SteveL-MSFT Steve Lee (SteveL-MSFT) Oct 21, 2017

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be because the executable is an actual ELF binary while the dlls are using the same format as Windows making them portable.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@thezim

Greg Zimmerman (thezim) commented Oct 20, 2017

Copy link
Copy Markdown
Contributor

This will fix #5034 as well.

SteveL-MSFT reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@iSazonov

Ilya (iSazonov) commented Oct 20, 2017 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

It seems CoreFX use System.Reflection.Metadata to read FileVersionInfo. Perhaps we can use the API to write meta data too.
CoreFX implementation

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@SteveL-MSFT

Steve Lee (SteveL-MSFT) commented Oct 21, 2017

Copy link
Copy Markdown
Member Author

Ilya (@iSazonov) I think we can move to that later particularly if we expose cmdlets for it

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@iSazonov

Ilya (iSazonov) commented Oct 21, 2017

Copy link
Copy Markdown
Collaborator

Steve Lee (@SteveL-MSFT) Do you want to exclude Unix from the PR?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@SteveL-MSFT

Steve Lee (SteveL-MSFT) commented Oct 21, 2017

Copy link
Copy Markdown
Member Author

Ilya (@iSazonov) using the file command, the executable is a native executable whereas the .dll assemblies are PE32+ format which supports the embedded resources. I don't think we can support this for non-Windows executables.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@iSazonov

Ilya (iSazonov) commented Oct 21, 2017

Copy link
Copy Markdown
Collaborator

Steve Lee (@SteveL-MSFT) Thanks for clarify. I see Unix haven't a standard for this.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

TravisEz13
Travis Plunk (TravisEz13) requested changes Oct 23, 2017
View reviewed changes
Comment thread build.psm1 Outdated
## need RCEdit to modify the binaries embedded resources
if (-not (Test-Path "~/.rcedit/rcedit-x64.exe"))
{
$rceditUrl = "https://github.com/electron/rcedit/releases/download/v1.0.0/rcedit-x64.exe"

@TravisEz13 Travis Plunk (TravisEz13) Oct 23, 2017

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we install this via chocolatey or nuget? Based on my understanding of our requirements for release builds, this will have to be rewritten sooner rather than later.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@TravisEz13 Travis Plunk (TravisEz13) Oct 23, 2017

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And move it to Start-PSBootstrap?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@iSazonov Ilya (iSazonov) Oct 24, 2017

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't found nuget package.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@SteveL-MSFT Steve Lee (SteveL-MSFT) Oct 24, 2017

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not on chocolatey or nuget currently. I could move the install to start-psbootstrap.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@TravisEz13 Travis Plunk (TravisEz13) Oct 25, 2017

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's under MIT license. Nothing keeps us from packaging it our self... and chocolatey, doesn't even package it, it just encapsulates the installation code.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@TravisEz13 Travis Plunk (TravisEz13) Oct 25, 2017

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But this can wait until we have to do it.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@SteveL-MSFT
address Travis' comments
1a06bb5
TravisEz13
Travis Plunk (TravisEz13) approved these changes Oct 25, 2017
View reviewed changes
iSazonov
Ilya (iSazonov) reviewed Oct 26, 2017
View reviewed changes
Comment thread build.psm1
# 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"))

@iSazonov Ilya (iSazonov) Oct 26, 2017

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about Windows 32-bit?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@SteveL-MSFT Steve Lee (SteveL-MSFT) Oct 26, 2017

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, will add 32-bit support

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@SteveL-MSFT Steve Lee (SteveL-MSFT) Oct 26, 2017

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I don't think any change is needed here. I believe we build x86 running as x64, so we can still use the x64 rcedit to modify the x86 binary.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@iSazonov Ilya (iSazonov) Oct 26, 2017

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clear. Thanks.

Closed.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@TravisEz13
Travis Plunk (TravisEz13) merged commit 4df7036 into PowerShell:master Oct 27, 2017
@SteveL-MSFT
Steve Lee (SteveL-MSFT) deleted the rcedit branch November 10, 2017 02:11
@thezim Greg Zimmerman (thezim) mentioned this pull request Sep 2, 2018
Why do we use rcedit? #7688
Closed
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
@SteveL-MSFT @TravisEz13
use rcedit to embed icon and version information into pwsh.exe (Power…
9e0434e
…Shell#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 PowerShell#2883
Fix PowerShell#5166
Fix PowerShell#5034
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@TravisEz13 Travis Plunk (TravisEz13) TravisEz13 approved these changes
@iSazonov Ilya (iSazonov) iSazonov left review comments
@adityapatwardhan Aditya Patwardhan (adityapatwardhan) Awaiting requested review from adityapatwardhan
@daxian-dbw Dongbo Wang (daxian-dbw) Awaiting requested review from daxian-dbw

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@TravisEz13 Travis Plunk (TravisEz13)

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@SteveL-MSFT @thezim @iSazonov @TravisEz13
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.