PS2EXE icon indicating copy to clipboard operation
PS2EXE copied to clipboard

My script will not run as a PS2EXE

Open mcdonamw opened this issue 2 years ago • 3 comments

I used the PS2EXE to convert my script to EXE but all it does is flash on the screen when ran. Running the script works fine.

I'm not sure how to debug this PS2EXE process to even begin looking at where the issue is. Doesn't seem to be any relevant documentation on PS2EXE. Thoughts or suggestions?

mcdonamw avatar Jun 24 '22 15:06 mcdonamw

Add some logging logic to your script to see if and what is running... or post an example of your script...

rzander avatar Jun 24 '22 15:06 rzander

So I ended up using the ps2exe gui version and made some progress (I'm getting stuff on screen), but unfortunately it's a bunch of errors. After the errors, many of the Write-Host statements I have in the script are displayed as annoying dialog boxes. I haven't gone through your documentation yet but is that expected?

If I use the suppress error option just to see if my form loads (it's a WPF application), I get the first few write-host/dialog boxes as expected but once done, it simply disappears with no form shown. The error in the picture appears to be the attempt to parse the XAML that creates the form so I guess that's why no form is shown. Is PS2EXE not compatible with WPF/XAML forms or something?

image

Update I just realized the GUI version I'm referencing is a different PS2EXE project from a differ author. My bad.

mcdonamw avatar Jun 27 '22 13:06 mcdonamw

Stupid question, but why not compiling an EXE directly by using C# and WPF ?

rzander avatar Jun 27 '22 19:06 rzander