package exe not work \\?\ path

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 4 years and 11 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.
MIC-23145632
Posts: 14
Last visit: Tue Apr 28, 2020 11:25 pm

package exe not work \\?\ path

Post by MIC-23145632 »

  1. $ListDir = "\\?\C:\Temp"
  2. 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
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: package exe not work \\?\ path

Post by davidc »

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
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: package exe not work \\?\ path

Post by davidc »

[TOPIC MOVED TO POWERSHELL STUDIO FORUM BY MODERATOR]
David
SAPIEN Technologies, Inc.
MIC-23145632
Posts: 14
Last visit: Tue Apr 28, 2020 11:25 pm

Re: package exe not work \\?\ path

Post by MIC-23145632 »

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 4488 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
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: package exe not work \\?\ path

Post by davidc »

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 4441 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
Last visit: Tue Apr 28, 2020 11:25 pm

Re: package exe not work \\?\ path

Post by MIC-23145632 »

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
pic
pic
Capture1.PNG (71.95 KiB) Viewed 4415 times
3. Select the file to be replaced
pic
pic
Capture2.PNG (23.95 KiB) Viewed 4415 times
4. The result still fails
pic
pic
Capture3.PNG (20.41 KiB) Viewed 4415 times
MIC-23145632
Posts: 14
Last visit: Tue Apr 28, 2020 11:25 pm

Re: package exe not work \\?\ path

Post by MIC-23145632 »

test sample files
Testing_exe.ps1
source
(496 Bytes) Downloaded 133 times
Testing_exe.xml
source
(3.53 KiB) Downloaded 133 times
Testing_exe.zip
package
(145.16 KiB) Downloaded 135 times
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: package exe not work \\?\ path

Post by davidc »

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
Last visit: Tue Apr 28, 2020 11:25 pm

Re: package exe not work \\?\ path

Post by MIC-23145632 »

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 4251 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 4251 times
  1. 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
  1. =================
  2. Begin Activation Context Generation.
  3. Input Parameter:
  4.     Flags = 0
  5.     ProcessorArchitecture = AMD64
  6.     CultureFallBacks = en-US;en
  7.     ManifestPath = C:\Users\chenghsunadmin\Documents\SAPIEN\PowerShell Studio\Files\bin\x64\Testing_exe.exe
  8.     AssemblyDirectory = C:\Users\chenghsunadmin\Documents\SAPIEN\PowerShell Studio\Files\bin\x64\
  9.     Application Config File = C:\Users\chenghsunadmin\Documents\SAPIEN\PowerShell Studio\Files\bin\x64\Testing_exe.exe.Config
  10. -----------------
  11. INFO: Parsing Application Config File C:\Users\chenghsunadmin\Documents\SAPIEN\PowerShell Studio\Files\bin\x64\Testing_exe.exe.Config.
  12. INFO: Parsing Manifest File C:\Users\chenghsunadmin\Documents\SAPIEN\PowerShell Studio\Files\bin\x64\Testing_exe.exe.
  13.     INFO: Manifest Definition Identity is (null).
  14.     ERROR: Line 3: The value %PLATFORM% of attribute processorArchitecture in element assemblyIdentity is invalid.
  15. ERROR: Activation Context generation failed.
  16. End Activation Context Generation.
  17.  
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: package exe not work \\?\ path

Post by davidc »

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.
This topic is 4 years and 11 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.