psbuild does not build a working .exe file.

Support for all customers who have purchased a SAPIEN PowerShell Studio product license. This forum does not offer a response time guarantee.
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE 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.
User avatar
bproscia
Posts: 2
Joined: Fri Mar 30, 2018 9:22 am

psbuild does not build a working .exe file.

Post by bproscia » Thu May 17, 2018 1:52 pm

PowerShell Studio 2018 v5.5.152
64 bit version of product:
Operating system:
64 bit OS:

The .exe produced by running the Packager from PowerShell Studio 2018 works correctly.
When using the command line tool 'psbuild' with the /PACKAGE option the .exe produced does not work.
The error displayed suggests that the .ps1 files that contain the required functions are not in the .exe.
Again, this works fine when packaged from PowerShell Studio GUI. We need the command line to work for our automated
build environment.

The output from PowershellStudio when it works: (I altered the names of our actual files.)
>> Package 'C:\GIT\tools\test.psproj'
>> Building (test) Project...
>> Merging 'Startup.pss' ...
>> Merging 'file1.ps1' ...
>> Merging 'file2.ps1' ...
>> Merging 'file3.ps1' ...
>> Merging 'file4.ps1' ...
>> Merging 'file5.ps1' ...
>> Merging 'file6.ps1' ...
>> Merging 'file7.ps1' ...
>> Merging 'file8.ps1' ...
>> Merging 'file9.ps1' ...
>> Writing 'test.Package.ps1' ...
SAPIEN Package and Deploy Tool 4.1 (c) 2005 - 2018 SAPIEN Technologies, Inc.

------ Build started: test, Configuration: x64 ------
Packaging with SAPIEN PowerShell V5 Host (Command line) x64
Adding C:\GIT\tools\test.Package.ps1
Writing scripts to bin\x64\test.exe
Embedding default manifest...
Package completed

>> Completed

The output from the 'psbuild' command when the .exe does not work:
C:\GIT\DG\hotfix_7.4.x\dgserver\hotfix\tools\services-stop>psbuild /PACKAGE "C:\GIT\tools\test.psproj.psbuild"
SAPIEN Package and Deploy Tool 4.1 (c) 2005 - 2018 SAPIEN Technologies, Inc.

------ Build started: test, Configuration: x64 ------
Packaging with SAPIEN PowerShell V5 Host (Command line) x64
Adding C:\GIT\tools\test.psproj
Writing scripts to bin\x64\test.exe
Embedding default manifest...
Package completed

It does seem obvious that the merging of the .ps1 files that contain required functions did not occur from the command line in the
same way that it did from the GUI.

Is my project missing a build option setting in order to get the command line to work for the same project file that works in PowerShell Studio?
Is there anything else that I might be doing wrong to cause this type of problem?

Your quick response would be very much appreciated.

-Regards

User avatar
davidc
Posts: 5190
Joined: Thu Aug 18, 2011 4:56 am

Re: psbuild does not build a working .exe file.

Post by davidc » Thu May 17, 2018 3:02 pm

Since this is a project, you must run it from PowerShell Studio, because the script needs to be generated in order for PSBuild to package it.

Note: This also includes psf files.
David
SAPIEN Technologies, Inc.

User avatar
bproscia
Posts: 2
Joined: Fri Mar 30, 2018 9:22 am

Re: psbuild does not build a working .exe file.

Post by bproscia » Thu May 17, 2018 3:53 pm

David,

Thanks for the rapid response.

Can you suggest a different way for me to set this up so we can build an .exe from the command line?
What alternative approaches or options would you suggest? I want to be able to combine multiple .ps1 function files
and create a .exe using psbuild if at all possible. This is a requirement from our build team to be able to automate the
creation of the .exe.

Regards,
-Bob

User avatar
davidc
Posts: 5190
Joined: Thu Aug 18, 2011 4:56 am

Re: psbuild does not build a working .exe file.

Post by davidc » Fri May 18, 2018 8:44 am

For the projects, there isn't a command line option at this time, but it is on our TODO list.

An alternate method would be to export the project to a ps1 file and automate the building of the exported script instead.
David
SAPIEN Technologies, Inc.