gpt4 book ai didi

msbuild - VSTS 构建失败并出现 MSB3325,无法导入 PFX key 文件

转载 作者:行者123 更新时间:2023-12-04 21:31:23 26 4
gpt4 key购买 nike

我创建了一个构建定义来在visualstudio.com上在线构建一个桌面应用程序,它在任务构建解决方案(Visual Studio构建)中失败并出现以下错误,

[error]C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(3156,5): Error MSB3325: Cannot import the following key file: Sixmod5Certificate.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_3B2BCC84AE4E26F1



我遵循了 https://developercommunity.visualstudio.com/content/problem/156086/vsts-build-msb3325-cannot-import-the-following-key.html 中指定的解决方案

然后在 https://stackoverflow.com/a/48698229/3531672 处指定
我在构建任务之前添加了一个powershell脚本任务,如下所示,
[CmdletBinding()]
param(
[Parameter(Mandatory)][string] $pfxpath,
[Parameter(Mandatory)][string] $password
)

Add-Type -AssemblyName System.Security
$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2
$cert.Import($pfxpath, $password, [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]"PersistKeySet")
$store = new-object system.security.cryptography.X509Certificates.X509Store -argumentlist "MY", CurrentUser
$store.Open([System.Security.Cryptography.X509Certificates.OpenFlags]"ReadWrite")
$store.Add($cert)
$store.Close()

但还没有运气

有不同的 SO 帖子类似于从管理员用户构建的指定解决方案,或手动安装 pfx 证书,但由于它们与个人计算机有关,我正在尝试在 visualstudio.com 上配置持续集成,它们似乎对我。

请注意,我能够在本地机器上成功构建。

如果您希望最终重新生成此问题,请按照以下步骤操作,

第 1 步:创建一个新的 VSTO 插件项目(任何 Excel/Word/Powerpoint)。

第 2 步:将此附加到 VSTS。

第 3 步:在应用程序属性的签名选项卡中,创建一个新的受密码保护的证书(在我的情况下为 PFX - 个人信息交换)并使用它来签署 ClickOnce list ,而不是使用临时证书

STEP 4:尝试在本地机器上构建,它会成功。

第 5 步:将其推过去并尝试在 VSTS 上构建,您将得到与上述相同的错误。

最佳答案

我从“项目属性 -> 签名”页面取消选中“签署程序集”复选框,一切都像一个魅力。该版本已通过 VSTS 成功签名。不知何故,我错过了许多与该问题相关的 SO 线程中提供的解决方案。

关于msbuild - VSTS 构建失败并出现 MSB3325,无法导入 PFX key 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50063626/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com