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 9 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 »

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
Alexander Riedel
Posts: 8473
Last visit: Tue Mar 19, 2024 1:15 am
Answers: 19
Been upvoted: 37 times

Re: Automated Package Build

Post by Alexander Riedel »

At the moment, no. Because PSBuild needs a complete, exported .ps1 file of the project, and that currently can only be created from within PowerShell Studio.
I do know that the team is working on a mechanism to do what you ask, but I do not know the state of that.
Maybe on Monday, when the team is back, someone can fill in the current state here.
Alexander Riedel
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 »

Happy to be a tester if you need!
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 »

Any further updates on this?
Alexander Riedel wrote: Sat Jun 06, 2020 8:30 am Maybe on Monday, when the team is back, someone can fill in the current state here.
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 »

It is the plan to add the ability to export psf files and projects from the command line in one of the next service builds. If I get more information, I'll update you.
Brittney
SAPIEN Technologies, Inc.
This topic is 3 years and 9 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.