Help Center/ CodeArts Deploy/ FAQs/ Custom Application Actions/ Decompressing a File/ Backslashes (\) Are Used as Path Separators in the Native Command Compress-Archive
Updated on 2024-08-06 GMT+08:00

Backslashes (\) Are Used as Path Separators in the Native Command Compress-Archive

Symptoms

The error message appears to use backslashes as path separators… is displayed.

Cause Analysis

When the native PowerShell command Compress-Archive or the action Build with MSBuild is used for packaging, the file path in the PowerShell command uses backslashes (\) as separators. This packaging mode has poor platform compatibility. As a result, the preceding problem occurs.

Solution

  1. Run the following script to build a package:
    1
    2
    3
    4
    5
    nuget restore 
    msbuild /p:OutputPath=../buildResult/Release/bin 
    powershell Invoke-WebRequest -UseBasicParsing https://www.7-zip.org/a/7z1900-x64.exe -OutFile ./7zip.exe
    7zip.exe /S
    "C:/Program Files/7-Zip/7z.exe" a ./archive.zip ./buildResult/Release/bin/*
    
  2. Use the 7-Zip packaging tool to create a customized package.