Page 1 of 2

package exe not work \\?\ path

Posted: Sun Apr 14, 2019 11:51 pm
by MIC-23145632
  1. $ListDir = "\\?\C:\Temp"
  2.  
  3. 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

Re: package exe not work \\?\ path

Posted: Mon Apr 15, 2019 8:49 am
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.

Re: package exe not work \\?\ path

Posted: Mon Apr 15, 2019 8:50 am
by davidc
[TOPIC MOVED TO POWERSHELL STUDIO FORUM BY MODERATOR]

Re: package exe not work \\?\ path

Posted: Mon Apr 15, 2019 6:13 pm
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 1887 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.

Re: package exe not work \\?\ path

Posted: Tue Apr 16, 2019 8:00 am
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 1840 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.

Re: package exe not work \\?\ path

Posted: Tue Apr 16, 2019 6:09 pm
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 1814 times
3. Select the file to be replaced
pic
pic
Capture2.PNG (23.95 KiB) Viewed 1814 times
4. The result still fails
pic
pic
Capture3.PNG (20.41 KiB) Viewed 1814 times

Re: package exe not work \\?\ path

Posted: Tue Apr 16, 2019 6:14 pm
by MIC-23145632
test sample files
Testing_exe.ps1
source
(496 Bytes) Downloaded 28 times
Testing_exe.xml
source
(3.53 KiB) Downloaded 23 times
Testing_exe.zip
package
(145.16 KiB) Downloaded 26 times

Re: package exe not work \\?\ path

Posted: Wed Apr 17, 2019 7:28 am
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.

Re: package exe not work \\?\ path

Posted: Thu Apr 18, 2019 8:53 pm
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 1650 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 1650 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.  
  3. Begin Activation Context Generation.
  4.  
  5. Input Parameter:
  6.  
  7.     Flags = 0
  8.  
  9.     ProcessorArchitecture = AMD64
  10.  
  11.     CultureFallBacks = en-US;en
  12.  
  13.     ManifestPath = C:\Users\chenghsunadmin\Documents\SAPIEN\PowerShell Studio\Files\bin\x64\Testing_exe.exe
  14.  
  15.     AssemblyDirectory = C:\Users\chenghsunadmin\Documents\SAPIEN\PowerShell Studio\Files\bin\x64\
  16.  
  17.     Application Config File = C:\Users\chenghsunadmin\Documents\SAPIEN\PowerShell Studio\Files\bin\x64\Testing_exe.exe.Config
  18.  
  19. -----------------
  20.  
  21. INFO: Parsing Application Config File C:\Users\chenghsunadmin\Documents\SAPIEN\PowerShell Studio\Files\bin\x64\Testing_exe.exe.Config.
  22.  
  23. INFO: Parsing Manifest File C:\Users\chenghsunadmin\Documents\SAPIEN\PowerShell Studio\Files\bin\x64\Testing_exe.exe.
  24.  
  25.     INFO: Manifest Definition Identity is (null).
  26.  
  27.     ERROR: Line 3: The value %PLATFORM% of attribute processorArchitecture in element assemblyIdentity is invalid.
  28.  
  29. ERROR: Activation Context generation failed.
  30.  
  31. End Activation Context Generation.
  32.  
  33.  

Re: package exe not work \\?\ path

Posted: Fri Apr 19, 2019 6:39 am
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.