Startup.pss and Globals.ps1 not running with project

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 1 year and 4 weeks 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.
bethanyalloway
Posts: 1
Last visit: Wed Mar 01, 2023 6:13 am

Startup.pss and Globals.ps1 not running with project

Post by bethanyalloway »

To help you better we need some information from you.

*** Please fill in the fields below. If you leave fields empty or specify 'latest' rather than the actual version your answer will be delayed as we will be forced to ask you for this information. ***

Product, version and build: Powershell Studio 2022 (64 bit), 5.8.213
Operating system: Windows 10
PowerShell version(s): 5.1.19041.2364

*** Please add details and screenshots as needed below. ***

Good morning,

I'm currently having an issue when I create a project (with Globals.ps1, startup.pss, and MainForm.psf automatically generated). For my form I am attempting to do Active Directory validation in my startup.pss file, with the functions used defined in the Globals.ps1, and the functions are also being used in my MainForm.psf. When I first create the project, everything works correctly; when you click the "Run" triangle icon in the "Build and Run" section on the "Home" menu it builds the script, merging the three files together as is expected, and runs all of the startup and mainform code successfully.

After I try to do the packager and installer builds, if I try to run MainForm.psf or the executable produced by the packager build, the application errors on the functions defined in the globals.ps1 and doesn't seem to run the startup.pss file.

Before, the console would specify that the three files are merging and the code in the startup.pss file would run and do the validation, but after I attempt to do any of the deploy steps, the console will only show that it is running the MainForm.psf file and does not show the merging and the code errors out.

When I look back at the files in Powershell Studio, the functions in Startup.pss are greyed out as unrecognized, and the same happens in the MainForm.psf file, even though no changes were made to the script on any of the files and all files are open in tabs in Powershell Studio.

In the packager settings I am building it using the Windows PowerShell - SAPIEN Powershell V5 Host (Windows Forms), Using STA Mode, with no Restrictions, Credentials, or Build Commands specified. In the Installer Settings I am using Product Type Script Application, with 64 bit installer checked, and no Signing, Custom Actions, or Services specified.

I was wondering if there was any advice on how to resolve this issue, if I remake the form by copy/paste without changing anything it will work again for a time. I'm not sure what setting I could be changing to cause this to stop running correctly.

Thanks!

DO NOT POST LICENSES, KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM
Attachments
Error FIle.txt
(10.28 KiB) Downloaded 27 times
Startup.pss
(2.21 KiB) Downloaded 25 times
Globals.ps1
(3.55 KiB) Downloaded 25 times
User avatar
brittneyr
Site Admin
Posts: 1655
Last visit: Thu Mar 28, 2024 3:14 pm
Answers: 39
Been upvoted: 30 times

Re: Startup.pss and Globals.ps1 not running with project

Post by brittneyr »

When packaging a project, the project is exported to a single script file (called ProjectName.package.ps1) that combines the Startup.pss, Globals.ps1, and MainForm.psf.

Files that a combined into this script have a project file setting of 'Include'. This can be set from the Properties Panel with the project file selected in the Project Panel. By default, these files should be set to 'Include'.

Please make sure you are packaging the project and not just the MainForm.psf file.

You may find the following articles helpful:
https://www.sapien.com/blog/2022/03/15/ ... roduction/
https://www.sapien.com/blog/2022/08/03/ ... -projects/
Brittney
SAPIEN Technologies, Inc.
This topic is 1 year and 4 weeks 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.