Automated Package Build

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
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.
This topic is 3 years and 4 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
Nillth
Posts: 34
Last visit: Mon Oct 30, 2023 10:52 pm
Has voted: 2 times

Automated Package Build

Post by Nillth »

Follow on from this Locked Topic:
viewtopic.php?f=12&t=14825&p=77932#p77932

Product: PowerShell Studio 2020 (64 Bit)
Build: v5.7.178
OS: Windows 10 Pro (64 Bit)
Build: v10.0.19635.0

Is there any way to automate the building of a psproj file?

e.g. the following will build a exe based off of a ps1 file using the psbuild config.

Code: Select all

"C:\Program Files\SAPIEN Technologies, Inc\PowerShell Studio 2020\PSBuild.exe" /Package "C:\PathTo\Test-Project\TestProject.ps1.psbuild"
however when attempting to build a project the exe fails.

Code: Select all

"C:\Program Files\SAPIEN Technologies, Inc\PowerShell Studio 2020\PSBuild.exe" /Package "C:\PathTo\Test-Project\TestProject.psproj.psbuild"
I can see that when PowerShell Studio builds a package from a Project, it first creates a consolidated package.. *.package.ps1 then uses that for the PSBuild Process.

Code: Select all

"C:\Program Files\SAPIEN Technologies, Inc\PowerShell Studio 2020\PSBuild.exe" /Package "C:\PathTo\Test-Project\TestProject.package.ps1.psbuild"
Is there anyway to build a psproj from cmdline? or does it have to go via the Gui?
As the only way I have figured out how to do it so far is kinda ugly...

Code: Select all

$PSStudio = "C:\Program Files\SAPIEN Technologies, Inc\PowerShell Studio 2020\PowerShell Studio.exe";
$WshShell = New-Object -ComObject WScript.Shell

$ProjectFile = $(Get-ChildItem -Filter "*.psproj").FullName
$ProjectStartupFile = $(Get-ChildItem -Filter "Startup.pss").FullName;

$SPSProc = Start-Process -PassThru -FilePath $PSStudio -ArgumentList $ProjectFile 

Write-Log "Started Process ID: $($SPSProc.Id)"
Start-Sleep -Seconds 30
& $PSStudio $ProjectStartupFile
Start-Sleep -Seconds 1

Write-Log "Activate Application"
While (!($WshShell.AppActivate($SPSProc.Id))) { Start-Sleep -Seconds 1 }

Write-Log "Start Build"
$WshShell.SendKeys("^{F7}")
Write-Log "Get PSBuild"
$PSBuild = $null
While ($null -eq $PSBuild){
$PSBuild = Get-Process -Name PSBuild -ErrorAction SilentlyContinue
Start-Sleep -Milliseconds 500
}
Write-Log "Got Build"
$PSBuild.WaitForExit()
Write-Log "PSBuild Complete"
While (!($WshShell.AppActivate($SPSProc.Id))) { Start-Sleep -Seconds 1 }
Write-Log "Exit Application"
$WshShell.SendKeys("%{F4}")
Write-Log "Finished"
User avatar
brittneyr
Site Admin
Posts: 1649
Last visit: Mon Mar 18, 2024 1:47 pm
Answers: 38
Been upvoted: 30 times

Re: Automated Package Build

Post by brittneyr »

With the latest service release (5.7.182), there is no way to build from the command line.

As we have now received multiple requests for this, we are working on a solution to build a project or form from the command line. This should be included in the next service release of PowerShell Studio.
Brittney
SAPIEN Technologies, Inc.
User avatar
Nillth
Posts: 34
Last visit: Mon Oct 30, 2023 10:52 pm
Has voted: 2 times

Re: Automated Package Build

Post by Nillth »

Not that I am excided to see this functionality....

:)
SAPIEN_Updates_fVUYKar0JO.png
SAPIEN_Updates_fVUYKar0JO.png (23.44 KiB) Viewed 21904 times
This topic is 3 years and 4 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.