VSTS Online - 使用 ClickOnce 签名 PFX 密码构建解决方案

2023-12-07

我有一个正在 VSTS Online 中构建的 WPF 解决方案。

以下是我的基本构建定义:

enter image description here

在本地 Visual Studio 2017 中,我分配了一次点击认证 (PFX)。一切都在本地构建和编译得很好。

enter image description here

构建失败并出现以下错误:

无法导入以下密钥文件: 。密钥文件可能是密码 受保护。要更正此问题,请尝试再次导入证书或 手动将证书导入到当前用户的个人证书中 证书存储。

我需要包括哪些设置/步骤来确保 PFX 文件可见并设置密码?


使用此代码导入证书文件(PowerShell 任务):

$pfxpath = 'pathtoees.pfx'
$password = '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()

相关主题:Visual Studio 团队服务部署/构建证书错误

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

VSTS Online - 使用 ClickOnce 签名 PFX 密码构建解决方案 的相关文章

随机推荐