【发布时间】:2020-06-18 21:29:00
【问题描述】:
我知道这个问题被问了很多。我已经在其他问题中尝试了许多解决方案,但没有奏效。
应用目标框架为4.5.2。
我正在使用 Visual Studio Community 2017 开发 Windows 7。
证书是 Sectigo 的代码签名证书。标准版(非 EV)。
我正在使用项目属性上的“签名”选项卡对应用程序进行签名。
在我将发布的文件上传到网络服务器之后,我将发布到我机器中的文件夹。
当我检查 setup.exe 和 myApp.exe 的属性时,两者都已正确签名和时间戳,或者至少看起来如此。
另外,\path\publish_folder\ 中的 myApp.application 文件、\path\publish_folder\Application Files\myApp_1_0_0_0\myApp.application 文件和 \path\publish_folder\Application Files\myApp_1_0_0_0\myApp.exe.manifest 具有与证书匹配的 <publisherIdentity> 标记。
一切似乎都很好,即使当我下载应用程序并运行 setup.exe 时,我也会收到以下警告,这没关系:
当 setup.exe 被执行时,会立即发布,但在 setup.exe 调用 myApp.application 之后,它会显示带有“Unknown Publisher”的警告,并且问题是:
我尝试在“受信任的根证书颁发机构”商店、“受信任的发布者”商店和“个人”商店中安装证书,然后再次发布应用程序,但同样的事情发生了。
在其他问题中说,Visual Studio 签名选项卡仅签署清单但没有签署可执行文件,正如您所见,这不是我的情况(setup.exe 和 myApp.exe 具有正确的数字签名)但即使我决定尝试使用 signtool sign 命令 (C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\signtool.exe) 进行签名并构建/发布事件,因为这些答案没有运气:
- .NET ClickOnce Signing results in "Unknown Publisher"
- https://robindotnet.wordpress.com/2013/02/24/windows-8-and-clickonce-the-definitive-answer-2/
我认为我唯一想尝试的是“签名程序集”选项(Visual Studio 中“签名”选项卡中的复选框),但是当我第一次这样做时出现错误:
Cannot import the following key file: myKey.pfx. The key file may be password protected. To correct this, try to import the certificate again or manually install the certificate to the Strong Name CSP with the following key container name: VS_KEY_5578EF228F7A794C myApp
然后我第二次尝试我得到这个错误:
Error importing key: An attempt was made to reference a token that does not exist
【问题讨论】:
标签: visual-studio clickonce code-signing code-signing-certificate