首页 > 解决方案 > VSTS 构建中的 Nuget 包还原错误

问题描述

我为 csproj 之一创建了一个构建定义,如下所示。

在此处输入图像描述

我在使用此定义的构建过程中遇到了与 nuget restore 相关的错误,有人可以帮我解决这个问题吗?

在此处输入图像描述

[更新]

根据评论中提供的建议,我已更新为“**\*.sln”然后它已经工作但我收到如下错误

在此处输入图像描述

标签: asp.net-corenugetazure-devopsazure-pipelines

解决方案


对于新问题,在构建定义中添加一个 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 团队服务部署/构建证书错误


推荐阅读