package exe not work \\?\ path

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.
MIC-23145632
Posts: 14
Joined: Sat Apr 13, 2019 6:40 am

package exe not work \\?\ path

Post by MIC-23145632 » Sun Apr 14, 2019 11:51 pm

Code: Select all

$ListDir = "\\?\C:\Temp"
Get-ChildItem -Path $ListDir -Recurse -Force
Working fine in ps1, but it is wrong to publish as exe
ERROR: Get-ChildItem : Illegal characters in path.
ERROR: At line:18 char:1
ERROR: + Get-ChildItem -Path $ListDir -Recurse -Force
ERROR: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ERROR: + CategoryInfo : NotSpecified: (:) [Get-ChildItem], ArgumentException
ERROR: + FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.GetChildItemCommand
ERROR:

powershell v5 commnad

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

Re: package exe not work \\?\ path

Post by davidc » Mon Apr 15, 2019 8:49 am

To support extended paths, you need to update the packager executable's manifest. You need to add the following:

Code: Select all

<application xmlns="urn:schemas-microsoft-com:asm.v3">
    <windowsSettings>
      <longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
    </windowsSettings>
</application>
Looking at the path you provided, there is no need for the "//?/" specifier.
David
SAPIEN Technologies, Inc.

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

Re: package exe not work \\?\ path

Post by davidc » Mon Apr 15, 2019 8:50 am

[TOPIC MOVED TO POWERSHELL STUDIO FORUM BY MODERATOR]
David
SAPIEN Technologies, Inc.

MIC-23145632
Posts: 14
Joined: Sat Apr 13, 2019 6:40 am

Re: package exe not work \\?\ path

Post by MIC-23145632 » Mon Apr 15, 2019 6:13 pm

davidc wrote:
Mon Apr 15, 2019 8:49 am
To support extended paths, you need to update the packager executable's manifest. You need to add the following:

Code: Select all

<application xmlns="urn:schemas-microsoft-com:asm.v3">
    <windowsSettings>
      <longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
    </windowsSettings>
</application>
Looking at the path you provided, there is no need for the "//?/" specifier.
I have a reference before you answer.
https://blogs.msdn.microsoft.com/jeremy ... indows-10/
Manually join, such as attachment files
Capture.PNG
Capture.PNG (17.85 KiB) Viewed 1533 times
But I have to add it manually every time I package. Is there a better way?

Thank you for your help, I am translating through Google. If there is any unclear expression, please let me know.

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

Re: package exe not work \\?\ path

Post by davidc » Tue Apr 16, 2019 8:00 am

You need to create a custom manifest. Here are the steps:

1. Copy the manifest template from PowerShell Studio's directory:

C:\Program Files\SAPIEN Technologies, Inc\PowerShell Studio 2019\Templates\manifest_template.xml

2. Save the copy and update the template. Look for the asmv3:application element in the xml file and update it as follows:

Code: Select all

<asmv3:application>
        <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
             <dpiAware>true</dpiAware>
			 <longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
        </asmv3:windowsSettings>
   </asmv3:application>
3. In Packager Settings->Output Settings select the "Embed a custom manifest file" from the combobox.
Packager - Custom Manifest.png
Packager - Custom Manifest.png (39.58 KiB) Viewed 1486 times

4. Then use the Custom Manifest field to browse to the file you created.

5. Build the package execute.

Please let us know if this works for you.

Note: In the next service release, I will include a packager manifest template to the New File templates. This save you from having to copy the file from PowerShell Studio's folder.
David
SAPIEN Technologies, Inc.

MIC-23145632
Posts: 14
Joined: Sat Apr 13, 2019 6:40 am

Re: package exe not work \\?\ path

Post by MIC-23145632 » Tue Apr 16, 2019 6:09 pm

davidc wrote:
Tue Apr 16, 2019 8:00 am
You need to create a custom manifest. Here are the steps:

1. Copy the manifest template from PowerShell Studio's directory:

C:\Program Files\SAPIEN Technologies, Inc\PowerShell Studio 2019\Templates\manifest_template.xml

2. Save the copy and update the template. Look for the asmv3:application element in the xml file and update it as follows:

Code: Select all

<asmv3:application>
        <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
             <dpiAware>true</dpiAware>
			 <longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
        </asmv3:windowsSettings>
   </asmv3:application>
3. In Packager Settings->Output Settings select the "Embed a custom manifest file" from the combobox.

Packager - Custom Manifest.png


4. Then use the Custom Manifest field to browse to the file you created.

5. Build the package execute.

Please let us know if this works for you.

Note: In the next service release, I will include a packager manifest template to the New File templates. This save you from having to copy the file from PowerShell Studio's folder.
1. I copied the template and changed the name to Testing_exe.xml
2. Use step 2 for content replacement 18~21 lines
Capture1.PNG
pic
Capture1.PNG (71.95 KiB) Viewed 1460 times
3. Select the file to be replaced
Capture2.PNG
pic
Capture2.PNG (23.95 KiB) Viewed 1460 times
4. The result still fails
Capture3.PNG
pic
Capture3.PNG (20.41 KiB) Viewed 1460 times

MIC-23145632
Posts: 14
Joined: Sat Apr 13, 2019 6:40 am

Re: package exe not work \\?\ path

Post by MIC-23145632 » Tue Apr 16, 2019 6:14 pm

test sample files
Testing_exe.ps1
source
(496 Bytes) Downloaded 16 times
Testing_exe.xml
source
(3.53 KiB) Downloaded 16 times
Testing_exe.zip
package
(145.16 KiB) Downloaded 18 times

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

Re: package exe not work \\?\ path

Post by davidc » Wed Apr 17, 2019 7:28 am

Your manifest create option is still set to "Embed a default manifest". Make sure you selected "Embed a custom manifest" before building the executable.
David
SAPIEN Technologies, Inc.

MIC-23145632
Posts: 14
Joined: Sat Apr 13, 2019 6:40 am

Re: package exe not work \\?\ path

Post by MIC-23145632 » Thu Apr 18, 2019 8:53 pm

davidc wrote:
Wed Apr 17, 2019 7:28 am
Your manifest create option is still set to "Embed a default manifest". Make sure you selected "Embed a custom manifest" before building the executable.
Thank you for your help. I have chosen to customize according to your notification.
Snipaste_2019-04-19_11-47-14.png
Snipaste_2019-04-19_11-47-14.png (27.4 KiB) Viewed 1296 times
But after the package is executed, I still get an error.
Please refer to the error message
Snipaste_2019-04-19_11-49-51.png
Snipaste_2019-04-19_11-49-51.png (10.54 KiB) Viewed 1296 times

Code: Select all

The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail.
sxstrace log is

Code: Select all

=================
Begin Activation Context Generation.
Input Parameter:
Flags = 0
ProcessorArchitecture = AMD64
CultureFallBacks = en-US;en
ManifestPath = C:\Users\chenghsunadmin\Documents\SAPIEN\PowerShell Studio\Files\bin\x64\Testing_exe.exe
AssemblyDirectory = C:\Users\chenghsunadmin\Documents\SAPIEN\PowerShell Studio\Files\bin\x64\
Application Config File = C:\Users\chenghsunadmin\Documents\SAPIEN\PowerShell Studio\Files\bin\x64\Testing_exe.exe.Config
-----------------
INFO: Parsing Application Config File C:\Users\chenghsunadmin\Documents\SAPIEN\PowerShell Studio\Files\bin\x64\Testing_exe.exe.Config.
INFO: Parsing Manifest File C:\Users\chenghsunadmin\Documents\SAPIEN\PowerShell Studio\Files\bin\x64\Testing_exe.exe.
INFO: Manifest Definition Identity is (null).
ERROR: Line 3: The value %PLATFORM% of attribute processorArchitecture in element assemblyIdentity is invalid.
ERROR: Activation Context generation failed.
End Activation Context Generation.

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

Re: package exe not work \\?\ path

Post by davidc » Fri Apr 19, 2019 6:39 am

Please update to the v162 service build. It will resolve the manifest issue as well as an encoding issue introduced in the v161 service build.

The v162 build also includes a manifest template you can access via the File->New menu. The template (Custom Packager Manifest) is located under the Other category.
David
SAPIEN Technologies, Inc.