【问题标题】:Azure Pipelines NuGet.config packages failed to restoreAzure Pipelines NuGet.config 包无法还原
【发布时间】:2020-03-27 00:12:38
【问题描述】:

您好,我是 Azure Pipelines 的新手

我正在尝试使用自定义 Nuget Config 构建 Xamarin 应用程序,但在执行还原命令时构建失败。 我收到以下错误:

nuget 命令失败,退出代码 (1) 和错误(无法从远程源 'http://nuget.uxdivers.com/grial/FindPackagesById()?id='BCrypt.Net-PCL'&semVerLevel=2.0.0' 检索有关 'BCrypt.Net-PCL' 的信息。输入不是有效的 Base-64 字符串,因为它包含非 base 64 字符、两个以上的填充字符或填充字符中的非法字符。

包“BCrypt.Net-PCL”是一个 NuGet 包,但恢复命令正在“uxdrivers”源中查找它。 如果我在没有自定义 NuGet.config 的情况下运行,则还原可以找到所有 NuGet 包,但显然它找不到没有 NuGet 源,因此构建也会失败。

我尝试改变包源、凭据的顺序并尝试了不同的 vmImage,但我总是以这个错误告终。 请原谅我对这一点的无知,因为我是 YAML 和管道的新手。

提前感谢您的帮助!

请看下面我的 YAML:

- task: NuGetCommand@2
  inputs:
    command: 'restore'
    restoreSolution: '**/*.sln'
    feedsToUse: 'config'
    nugetConfigPath: 'NuGet.config'

见下面我的 NuGet.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <clear />
 <packageSources>
  <add key="Grial" value="http://nuget.uxdivers.com/grial"/>
  <add key="Syncfusion_Xamarin" value="https://nuget.syncfusion.com/nuget_xamarin/nuget/getsyncfusionpackages/xamarin"/>
  <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
 </packageSources>
<packageSourceCredentials>
 <Syncfusion_Xamarin>
  <add key="Username" value="*MyUsername*" />
  <add key="Password" value="*MyPassword*" />
 </Syncfusion_Xamarin>
 <Grial>
  <add key="Username" value="*MyUsername*" />
  <add key="Password" value="*MyPassword*" />
 </Grial>
</packageSourceCredentials>

【问题讨论】:

    标签: nuget yaml azure-pipelines


    【解决方案1】:

    Azure Pipelines NuGet.config 包无法还原

    您在Nuget.Config 文件中配置的方式似乎有语法错误。

    如果有加密的密码,它将无法在其他机器上运行,因为它是使用存储在您的开发机器上的密钥进行编码的。您可以将其替换为明文密码,例如:

    <add key="Username" value="%USER_VARIABLE%" />
    <add key="Password" value="%PASSWORD_VARIABLE%" />
    

    或使用cleartextpassword

    <add key="Username" value="user" />
    <add key="ClearTextPassword" value="xxxxxx" />
    

    查看文档nuget.config reference 了解更多详情。

    希望这会有所帮助。

    【讨论】:

      猜你喜欢
      • 2022-01-18
      • 1970-01-01
      • 2021-01-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-11-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多