Script packager options

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
Lembasts
Posts: 202
Joined: Thu Mar 15, 2012 9:47 am

Script packager options

Post by Lembasts » Tue Mar 29, 2016 3:08 pm

Product, version and build: ps 2015 4.2.99
32 or 64 bit version of product: 64
Operating system: win7
32 or 64 bit OS: 64

I've looked at the script packager doc but it doesn't answer the following questions:
What is STA mode and when do you need to use it?
What is 'generate config file' and when would you need to use it?

Thanks

David

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

Re: Script packager options

Post by davidc » Tue Mar 29, 2016 3:25 pm

This article covers when to use STA mode:

https://www.sapien.com/blog/2015/03/09/ ... -sta-mode/


We include the config file when generating the packaged exe for user convenience. The configuration file tells the .NET application that is OK to load these legacy assemblies; otherwise they would fail to load. Some PowerShell V2 modules have assemblies writing in .NET 2.0 that will not load in later versions of .NET / PowerShell without this config file. You don't notice this issue in PowerShell Studio or PowerShell.exe because they already have this configuration file.

David
David
SAPIEN Technologies, Inc.

User avatar
Lembasts
Posts: 202
Joined: Thu Mar 15, 2012 9:47 am

Re: Script packager options

Post by Lembasts » Tue Mar 29, 2016 3:34 pm

Thanks

So just in case I want to use folderbrowserdialog etc I should always turn on STA mode it seems. There appears to be no advantage to not using it.
I'm still unsure about the config file. If we run powershell v4 and that is the version I set for the platform on the home tab I will never need the config file?

Cheers

David

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

Re: Script packager options

Post by davidc » Tue Mar 29, 2016 3:46 pm

If you are using a GUI it is a safe bet to enable STA.

The need for the config file really depends on what you are doing or using. Snapins like Exchange may require it if you are working in V3 or up. In most cases the config file might not be necessary but there is no harm in including it.

David
David
SAPIEN Technologies, Inc.

User avatar
Alexander Riedel
Posts: 6951
Joined: Tue May 29, 2007 4:43 pm

Re: Script packager options

Post by Alexander Riedel » Tue Mar 29, 2016 4:28 pm

Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
Lembasts
Posts: 202
Joined: Thu Mar 15, 2012 9:47 am

Re: Script packager options

Post by Lembasts » Tue Mar 29, 2016 4:40 pm

Thanks all. I know exactly what to do now.

Cheers

David