【问题标题】:VSTS Online - Build Solution With ClickOnce Signing PFX PasswordVSTS Online - 使用 ClickOnce 签名 PFX 密码构建解决方案
【发布时间】:2018-07-19 10:07:12
【问题描述】:

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

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

在本地的 Visual Studio 2017 中,我分配了一次单击认证 (PFX)。一切都可以在本地构建和编译。

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

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

我需要包含哪些设置/步骤以确保看到 PFX 文件并设置密码?

【问题讨论】:

    标签: wpf azure-devops clickonce pfx


    【解决方案1】:

    使用此代码导入证书文件(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 team services deploymen/buildt certificate error

    【讨论】:

    • $password 应该使用什么值?我已经尝试了证书密码和我的帐户密码。两者都给出带有“3”参数的异常调用“导入”:“指定的网络密码不正确。”
    • 应该是证书密码。
    • 这不是安全风险吗?不会在共享机器上导入证书,包括它的私钥吗?
    • 我将它作为 Azure DevOps 构建管道的一部分作为电源 shell 脚本任务运行。任务完成且没有错误,但我的构建失败并显示无法导入以下密钥文件:Image1.pfx。密钥文件可能受密码保护。要更正此问题,请尝试再次导入证书或手动将证书安装到具有以下密钥容器名称的强名称 CSP:VS_KEY_60E41B07B11F3C7E
    • @starianchen-MSFT 不适合我。我仍然收到与斯图尔特说的相同的错误消息。
    猜你喜欢
    • 2018-02-19
    • 1970-01-01
    • 2017-11-18
    • 2011-12-24
    • 1970-01-01
    • 1970-01-01
    • 2018-08-26
    • 2015-04-27
    • 1970-01-01
    相关资源
    最近更新 更多