Hi,
I convert my powershell GUI into an exe/msi and use the 'auto-increment' of exe, then use exe for version in msi.
First: if generating MSI, should I first generate exe or will the msi creation generate the exe (I think I should, but just checking)?
Second: I'd like to show the version in the form header (I put it into the globals.ps1 now $Version ='1.0.0.0', then at formload, Title = $version ...
Can I read the version somewhere from a variable instead of putting the version into the globals.ps1?
Thanks!
Buildversion, use exeversion to show in GUI?
Forum rules
Do not post any licensing information in this forum.
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 any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: Buildversion, use exeversion to show in GUI?
I recommend posting issues of how to use PSS to the Customer Support forum for PSS. Sapien techs will answer your questions about the product itself. The Community Forums are for PowerShell specific questions/
Re: Buildversion, use exeversion to show in GUI?
you can call the following from inside your script.
It will pull determine the running file and pull the version info from it.
It will pull determine the running file and pull the version info from it.
Code: Select all
$RuntimeFileInfo = Get-Item $hostinvocation.MyCommand.path
$RuntimeVersion = $($RuntimeFileInfo.VersionInfo.ProductVersion)
Re: Buildversion, use exeversion to show in GUI?
It worked fine, but it appears my GUI throws errors on that code all the time.
When running the GUI via console, I see errors all the time which makes that my gui takes up to a minute to load
l\Globals.ps1:330 char:29
+ $RuntimeFileInfo = Get-Item $hostinvocation.MyCommand.path
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidat
ionException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Micro
soft.PowerShell.Commands.GetItemCommand
When running the GUI via console, I see errors all the time which makes that my gui takes up to a minute to load
l\Globals.ps1:330 char:29
+ $RuntimeFileInfo = Get-Item $hostinvocation.MyCommand.path
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidat
ionException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Micro
soft.PowerShell.Commands.GetItemCommand
Re: Buildversion, use exeversion to show in GUI?
I repeat myself. In pojects use the following function to get teh script path.
Get-ScriptDirectory
It is the only way to get the path both as a script and as a package.
Get-ScriptDirectory
It is the only way to get the path both as a script and as a package.
Re: Buildversion, use exeversion to show in GUI?
The code that is erring won't work outside of an EXE.
What is it that you want the version of? PowerShell? A file? Windows?
Re: Buildversion, use exeversion to show in GUI?
To get the current EXE version
[system.diagnostics.process]::GetCurrentProcess().ProductVersion
To get the file version:
[system.diagnostics.process]::GetCurrentProcess().MainModule.FileVersion
[system.diagnostics.process]::GetCurrentProcess().ProductVersion
To get the file version:
[system.diagnostics.process]::GetCurrentProcess().MainModule.FileVersion