问题描述
我在appveyor构建(Visual Studio 2019)上有这种超级奇怪的行为:在shell脚本(cmd.exe)中,当用config/auth.PHP
签名我的应用程序时,所有选项都被解释为文件( signtool
可以一次签署多个文件。
第signtool
行产生:
"$WINDOWSKITBIN\\signtool.exe" sign /tr http://timestamp.digicert.com /td sha256 /fd SHA256 /n "Jan Gerner" /v /debug "build\\TypeWorld.exe"
仅在没有所有选项的情况下,对所需文件Successfully signed: build\TypeWorld.exe
Number of files successfully Signed: 1
Number of errors: 10
SignTool Error: File not found: C:/Program Files/Git/tr
SignTool Error: File not found: http://timestamp.digicert.com
SignTool Error: File not found: C:/Program Files/Git/td
SignTool Error: File not found: sha256
SignTool Error: File not found: C:/Program Files/Git/fd
SignTool Error: File not found: SHA256
SignTool Error: File not found: N:/
SignTool Error: File not found: Jan Gerner
SignTool Error: File not found: V:/
SignTool Error: File not found: C:/Program Files/Git/debug
进行了签名,显然所有选项都被解释为要签名的文件,显然找不到。
我已经确认转义的反斜杠和文件夹变量是正确的。
此行TypeWorld.exe
产生预期的渲染:echo "$WINDOWSKITBIN\\signtool.exe" sign /tr http://timestamp.digicert.com /td sha256 /fd SHA256 /n "Jan Gerner" /v /debug "build\\TypeWorld.exe"
我尝试在PowerShell中运行相同的结果。
解决方法
AppVeyor员工的建议(也通过电子邮件)都无济于事。
最终的帮助是不要将Windows和Linux(WSL)环境混合在一起。在appveyor.yml
中,我是通过sh
(或在AppVeyor员工的推荐下,后来是bash
)调用构建脚本的:
build_script:
- cmd: C:\\msys64\\usr\\bin\\bash.exe wxPython/build/Windows/build-all.sh
相反,对于某些命令而言,最好使事情保持简单,因此我将代码签名部分转换为旧的Windows批处理文件:
build_script:
- wxPython/build/Windows/build-sign.bat
在批处理文件中,该行
signtool.exe sign /tr http://timestamp.digicert.com /td sha256 /fd SHA256 /n "Jan Gerner" /v "build\\TypeWorld.exe"
执行正常。