FolderBrowserModernDialog not working in compiled .exe

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

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 8 years and 2 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.
Locked
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: FolderBrowserModernDialog not working in compiled .exe

Post by davidc »

What build do you have installed? I tested this on my end and the settings save.

It could be that it can't override the *.psproj.psbuild file. You can check the file and look for:
STA=1

David
David
SAPIEN Technologies, Inc.
User avatar
dan.potter
Posts: 709
Last visit: Wed Nov 14, 2018 11:39 am

Re: FolderBrowserModernDialog not working in compiled .exe

Post by dan.potter »

I packed an exe for him v3 (windows forms) x64 with sta mode and he couldn't run it.
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: FolderBrowserModernDialog not working in compiled .exe

Post by davidc »

tirwin,

Please post in the product support forums and we will assist you further.

David
David
SAPIEN Technologies, Inc.
User avatar
tirwin@iot.in.gov
Posts: 40
Last visit: Tue Mar 14, 2017 9:54 am

Re: FolderBrowserModernDialog not working in compiled .exe

Post by tirwin@iot.in.gov »

Was wondering if anyone had any ideas about the above problem? :?: I don't understand why it would work in my ISE but not in the compiled program? I freezes my app with "Not Responding" displayed at the top of the form. I checked the "STA mode" in the "Engine Settings" dialog and tried to compile but it still does not work. Also when I reopen the "Engine Settings" it has the "STA Mode" unchecked again. (This does not seen right). Any help would be greatly appreciated.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: FolderBrowserModernDialog not working in compiled .exe

Post by jvierra »

From your previous posts it appear you are trying to run the form under the V2 commandline host. That won't work.

Image

Notice that this is the commandline host.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: FolderBrowserModernDialog not working in compiled .exe

Post by jvierra »

Here is how to package a form:
bldfrm.jpg
bldfrm.jpg (83.39 KiB) Viewed 2965 times
User avatar
tirwin@iot.in.gov
Posts: 40
Last visit: Tue Mar 14, 2017 9:54 am

Re: FolderBrowserModernDialog not working in compiled .exe

Post by tirwin@iot.in.gov »

I was wondering if anyone had any ideas about the above problem. The FolderModernDialog works in the ISE but does not work in the compiled program. When I run the compiled program it "Freezes". I get "Not Responding" at the top of the form and I have to stop it from the task manager. I tried the above mentioned in the "Engine Settings" I checked the "STA Mode" box and recompiled and ran the program and it still freezes up. Also when I reopen the "Engine Setting" dialog the "STA Mode" box is not checked. (This does not seem correct). I have no ideas to correct this cold someone help.
User avatar
tirwin@iot.in.gov
Posts: 40
Last visit: Tue Mar 14, 2017 9:54 am

Re: FolderBrowserModernDialog not working in compiled .exe

Post by tirwin@iot.in.gov »

Follow up on above. I have put the following script in my code per this page.
https://www.sapien.com/blog/2015/03/09/ ... -sta-mode/
and it still does not work. Also I have put a Label on my form with the following cmd.
$testexe.Text = $Host.Runspace.ApartmentState
and the $testexe.Text is empty. Yes my default powershell version is 2.0
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: FolderBrowserModernDialog not working in compiled .exe

Post by jvierra »

You need to create the simplest form that has the problem and post the whole form. I suspect you are doing something in the form that is corrupting the runtime.

Post the PSF file. If it is not a scripting error then you either have a corrupted Net Framework or a corrupted PowerShell Studio installation.
User avatar
dan.potter
Posts: 709
Last visit: Wed Nov 14, 2018 11:39 am

Re: FolderBrowserModernDialog not working in compiled .exe

Post by dan.potter »

jvierra wrote:You need to create the simplest form that has the problem and post the whole form. I suspect you are doing something in the form that is corrupting the runtime.

Post the PSF file. If it is not a scripting error then you either have a corrupted Net Framework or a corrupted PowerShell Studio installation.

I gave him a basic form and he said the system either refuses to run it or stops responding when run as admin. I'm guessing system issue or security policy. What is the execution policy set to?
This topic is 8 years and 2 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.
Locked