WiX Toolset Insignia 错误 INSG0001 访问路径被拒绝

WiX Toolset Insignia error INSG0001 Access to the path is denied

您好,我使用 WiX 工具集 v3.11 部署了几个项目。一段时间以来,这一直没有问题。我在 Visual Studio 2017 中使用 Post-build 事件命令行对我的安装包进行数字签名。不幸的是,我电脑上的 USB 出了问题,所以我不得不重新安装 Windows 10。由于重新安装 Post-build 命令不再 运行。我希望解决方案是我忽略的简单方法。

Post 构建命令

"C:\Program Files (x86)\WiX Toolset v3.11\bin\insignia.exe" -ib Installer.exe -o engine.exe
"C:\Program Files (x86)\Windows Kits\bin.0.16299.0\x86\signtool.exe" sign /f "c:\users\username\documents\Cert.pfx" /p "password" /d "My Software" /fd sha256 /tr http://timestamp.comodoca.com/rfc3161 /td sha256 "engine.exe"
"C:\Program Files (x86)\WiX Toolset v3.11\bin\insignia.exe" -ab engine.exe Installer.exe -o Installer.exe 
"C:\Program Files (x86)\Windows Kits\bin.0.16299.0\x86\signtool.exe" sign /f "c:\users\username\documents\Cert.pfx" /p "password" /d "My Software" /fd sha256 /tr http://timestamp.comodoca.com/rfc3161 /td sha256 "$(TargetPath)"
del engine.exe

构建的输出

Windows Installer XML Toolset Inscriber version 3.11.1.2318
2>  Copyright (c) .NET Foundation and contributors. All rights reserved.
2>Insignia.exe(0,0): error INSG0001: Access to the path is denied.
2>  Exception Type: System.UnauthorizedAccessException
2>  Stack Trace:
2>     at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
2>     at System.IO.__Error.WinIOError()
2>     at System.IO.File.InternalMove(String sourceFileName, String destFileName, Boolean checkHost)
2>     at Microsoft.Tools.WindowsInstallerXml.Inscriber.InscribeBundleEngine(String bundleFile, String outputFile)
2>     at Microsoft.Tools.WindowsInstallerXml.Tools.Insignia.Run(String[] args)
2>  Done Adding Additional Store
2>  Number of errors: 1
2>EXEC(0,0): error : File not found: engine.exe
2>  Windows Installer XML Toolset Inscriber version 3.11.1.2318
2>  Copyright (c) .NET Foundation and contributors. All rights reserved.
2>Insignia.exe(0,0): error INSG0001: Could not find file 'C:\Users\username\Documents\Visual Studio 2017\Projects\My Sotware\Bootstrapper\bin\Release\engine.exe'.
2>  Exception Type: System.IO.FileNotFoundException
2>  Stack Trace:
2>     at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
2>     at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
2>     at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite)
2>     at Microsoft.Tools.WindowsInstallerXml.Inscriber.InscribeBundle(String bundleFile, String signedEngineFile, String outputFile)
2>     at Microsoft.Tools.WindowsInstallerXml.Tools.Insignia.Run(String[] args)
2>  Done Adding Additional Store
2>  Successfully signed: C:\Users\username\Documents\Visual Studio 2017\Projects\My Software\Bootstrapper\bin\Release\Installer.exe
2>  Could Not Find C:\Users\username\Documents\Visual Studio 2017\Projects\My Software\Bootstrapper\bin\Release\engine.exe
2>C:\Program Files (x86)\MSBuild\Microsoft\WiX\v3.x\wix2010.targets(2832,5): error MSB3073: The command ""C:\Program Files (x86)\WiX Toolset v3.11\bin\insignia.exe" -ib Installer.exe -o engine.exe
2>"C:\Program Files (x86)\Windows Kits\bin.0.16299.0\x86\signtool.exe" sign /f "c:\users\username\documents\Cert.pfx" /p "password" /d "My Software" /fd sha256 /tr http://timestamp.comodoca.com/rfc3161 /td sha256 "engine.exe"
2>"C:\Program Files (x86)\WiX Toolset v3.11\bin\insignia.exe" -ab engine.exe Installer.exe -o Installer.exe 
2>"C:\Program Files (x86)\Windows Kits\bin.0.16299.0\x86\signtool.exe" sign /f "c:\users\username\documents\Cert.pfx" /p "password" /d "My Software" /fd sha256 /tr http://timestamp.comodoca.com/rfc3161 /td sha256 "C:\Users\username\Documents\Visual Studio 2017\Projects\My Software\Bootstrapper\bin\Release\Installer.exe"
2>del engine.exe" exited with code -1.
2>Done building project "Bootstrapper.wixproj" -- FAILED.

作为参考,解决方案确实很简单,我的安全软件 BitDefender Total Security 2018 被阻止访问。

允许访问

  • 打开 Bitdefender
  • 单击 'View Features' link(向右)
  • 在 'Sale Files' 磁贴中单击 'Application Access'
  • 将'WiX Toolset Inscriber'切换为允许