Inconsistent Behavior and Errors with SapienCommandLine.exe

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 8 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.
LeoRiesenbach
Posts: 2
Last visit: Wed Jul 27, 2022 6:43 am

Inconsistent Behavior and Errors with SapienCommandLine.exe

Post by LeoRiesenbach »

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, 5.8.207
Operating system: Windows 10 Enterprise 10.0.19044
PowerShell version(s): 5.1.19041.1682

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

I am trying to use SapienCommandLine.exe to create a CI system for my PowerShell projects that are packaged using PowerShell Studio.
On my own system, I have this working perfectly fine. When I run the command I get this output and the project compiles:

Code: Select all

PS [path]> & "C:\Program Files\SAPIEN Technologies, Inc\PowerShell Studio 2022\sapiencommandline.exe" /buildexe "./[proj name].psproj"
>> Starting...
>> Writing '[proj name].Package.ps1' ...
>> Package './[proj name].psproj'
>> SAPIEN Package and Deploy Tool 4.5 (c) 2005 - 2022 SAPIEN Technologies, Inc.

etc etc etc, just the standard output from the compiler
However, on a fresh install of the same version of PowerShell Studio on the VM that I'm using as an agent for my CI pipeline running on the exact same code, I get this:

Code: Select all

PS [path]>& "C:\Program Files\SAPIEN Technologies, Inc\PowerShell Studio 2022\sapiencommandline.exe" /buildexe "./[proj name].psproj"
>> Starting...
>> Error: Unable to determine build settings.
>> Error: Unable to build package. Check build settings for packaging.
On the VM I'm still able to compile using the PowerShell Studio "Package" button and the Script Packager GUI for this project, but using the command line version does not work at all. Any insight as to how I could fix this?

I have tried invoking psbuild.exe directly with

Code: Select all

PS [path]> & "C:\Program Files\SAPIEN Technologies, Inc\PowerShell Studio 2022\psbuild.exe" /package "./[proj name].psproj.psbuild"
SAPIEN Package and Deploy Tool 4.5 (c) 2005 - 2022 SAPIEN Technologies, Inc.

Error: Invalid buffer
File version incremented to 1.0.5.0
Product version incremented to 1.0.5.0
------ Build started: Sealing Manager, Configuration: x64 ------
Packaging with SAPIEN PowerShell V5 Host (Command line) x64
Adding ./[proj name].psproj
Writing scripts to bin\x64\[proj name].exe
Embedding elevated manifest...
Package completed
This does output an exe on both machines, but it seems to have packaged the psproj file itself instead of the ps1 and psf files, so it just gives me thousands of lines of errors exactly like this when I try to run it :

Code: Select all

ERROR:  < : The term ' <' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
ERROR: spelling of the name, or if a path was included, verify that the path is correct and try again.
ERROR: At line:3 char:1
ERROR: +  < P r o j e c t   S y n c h r o n i z e d = " F a l s e "   S y n c  ...
ERROR: + ~~
ERROR:     + CategoryInfo          : ObjectNotFound: ( <:String) [], CommandNotFoundException
ERROR:     + FullyQualifiedErrorId : CommandNotFoundException
ERROR:
Preparing modules for first use.
Preparing modules for first use.
User avatar
brittneyr
Site Admin
Posts: 1654
Last visit: Wed Mar 27, 2024 1:54 pm
Answers: 39
Been upvoted: 30 times

Re: Inconsistent Behavior and Errors with SapienCommandLine.exe

Post by brittneyr »

I've been able to reproduce similar behavior during my tests and have informed the development team.

Does this work if you specify the absolute file path of the psproj file?
Brittney
SAPIEN Technologies, Inc.
LeoRiesenbach
Posts: 2
Last visit: Wed Jul 27, 2022 6:43 am

Re: Inconsistent Behavior and Errors with SapienCommandLine.exe

Post by LeoRiesenbach »

Yes, that worked. Thank you very much!

I would love to see some real documentation on SapienCommandLine.exe at some point... maybe a blog post about how to use it in a CI environment would be helpful to a lot of people?
This topic is 1 year and 8 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.