Continuous integration 在repo中添加了最新过期日期的新.pfx文件后,VSTS CICD生成管道失败

Continuous integration 在repo中添加了最新过期日期的新.pfx文件后,VSTS CICD生成管道失败,continuous-integration,azure-devops,azure-pipelines,continuous-deployment,Continuous Integration,Azure Devops,Azure Pipelines,Continuous Deployment,我为一个UWP项目创建了一个CICD管线。具有以下代码的管道powershell任务失败,给出错误消息错误APPX0108:指定的证书已过期。有关续订证书的更多信息,请参阅 因此,我在Visual Studio 2017中创建了一个新的测试证书,到期日期为明年,并将新证书(.pfx)文件推送到repo。我还更新了.csproj文件,将其更新为新证书的名称 现在,对于管道中的构建解决方案任务,我得到了相同的错误。我想知道我错过了什么。我是否也必须将该证书添加到构建服务器中 PowerShell脚本

我为一个UWP项目创建了一个CICD管线。具有以下代码的管道powershell任务失败,给出错误消息错误APPX0108:指定的证书已过期。有关续订证书的更多信息,请参阅

因此,我在Visual Studio 2017中创建了一个新的测试证书,到期日期为明年,并将新证书(.pfx)文件推送到repo。我还更新了.csproj文件,将其更新为新证书的名称

现在,对于管道中的构建解决方案任务,我得到了相同的错误。我想知道我错过了什么。我是否也必须将该证书添加到构建服务器中

PowerShell脚本代码:

Param(
        [String]$pfxpath,
        [String]$password
    )


    if (-Not $pfxpath) {
        Write-Host "Certificate path not set"
        exit 1
    }

    if (-Not $password) {
        Write-Host "Password not set"
        exit 1
    }

    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()

你能分享详细记录吗?(将system.debug变量设置为true)如何指定$pfxpath参数?是新文件路径吗?我已经解决了。新证书似乎需要手动安装到生成服务器中。@goldy14388,很高兴知道您已解决此问题,如果可能,您可以将您的解决方案作为答案共享,然后将其标记为答案。@JackZhai MSFT,我必须手动将证书安装到生成服务器上,我更改了.csproj文件,其中包含新的证书详细信息,一切正常。@goldy14388,非常感谢您的友好回复,请查看此链接:,以便您可以将解决方案作为答案(而不是注释)共享,并将其作为带有绿色复选标记的答案接受。