Product, version and build: Powershell Studio 2023 5.8.221
Operating system: win 11 22h2
PowerShell version(s):5.1
I've built my first powershell application and it works great, I'm trying to version the software so I always know which version the user is on. in the build settings you can manage this this in the Version Information section with File version, and Product version. you can even check the box for "auto-increment file and product version" which sounds great. I'm just wondering if there is a way in the powershell code to reference this value automatically from the file to present the user with the current build version?
Putting build information into compiled builds.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: Putting build information into compiled builds.
You can get the product version information for a running packaged executable from the following line:
If you are not running the packaged executable, you can get the product version from the exe file.
The following may be helpful:
https://stackoverflow.com/questions/306 ... powershell
- [System.Windows.Forms.Application]::ProductVersion
The following may be helpful:
https://stackoverflow.com/questions/306 ... powershell
Brittney
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: Putting build information into compiled builds.
Thanks your reference mirrors how I ended up solving it as well:
(My app name is Populeateeid.exe, Line 1 finds the process exe wherever they launched it from and shows information for the most recently launched copy. then populates my label lblver with the content of the product version from the file property)
$pathtofile = (get-process populate*eid* | sort starttime | select -First 1).path
$lblver.text = (Get-ItemProperty -Path $pathtofile).versioninfo.productversion
(My app name is Populeateeid.exe, Line 1 finds the process exe wherever they launched it from and shows information for the most recently launched copy. then populates my label lblver with the content of the product version from the file property)
$pathtofile = (get-process populate*eid* | sort starttime | select -First 1).path
$lblver.text = (Get-ItemProperty -Path $pathtofile).versioninfo.productversion