Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/visual-studio/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Azure devops Azure上Nuget还原步骤上特定包源的Nuget包_Azure Devops_Nuget_Nuget Package Restore - Fatal编程技术网

Azure devops Azure上Nuget还原步骤上特定包源的Nuget包

Azure devops Azure上Nuget还原步骤上特定包源的Nuget包,azure-devops,nuget,nuget-package-restore,Azure Devops,Nuget,Nuget Package Restore,我试图还原的包位于nuget.org和第三方myget上。第三方是我想要使用的更高版本(预发行版),但它似乎甚至没有尝试查找此软件包的myget源代码,因为它在nuget.org上找到了该软件包,但我想要的版本除外,导致以下错误消息: ##[error]The nuget command failed with exit code(1) and error(Errors in packages.config projects Unable to find version '2.0.0-dev-0

我试图还原的包位于
nuget.org
和第三方myget上。第三方是我想要使用的更高版本(预发行版),但它似乎甚至没有尝试查找此软件包的myget源代码,因为它在nuget.org上找到了该软件包,但我想要的版本除外,导致以下错误消息:

##[error]The nuget command failed with exit code(1) and error(Errors in packages.config projects
Unable to find version '2.0.0-dev-00013' of package 'Discord.Addons.Interactive'.
  https://api.nuget.org/v3/index.json: Package 'Discord.Addons.Interactive.2.0.0-dev-00013' is not found on source 'https://api.nuget.org/v3/index.json'.)
myget在我的解决方案根目录下的my nuget.config中正确配置

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
    <add key="Foxbot" value="https://www.myget.org/F/foxbot-discord-addons/api/v3/index.json" />
  </packageSources>
</configuration>


如何使nuget还原步骤尊重此程序包的myget程序包源?

不再有源的优先级,最快的源获胜

包在id和版本上应该是唯一的,不支持提要包含相同id/版本的不同变体的场景

优先级排序导致了性能问题,因为对源的调用是顺序的,而不是并行的。我建议您采取以下措施来解决此问题:

  • 避免使用具有相同id/版本的不同软件包,或者在已经解决问题的情况下,通过使用单个提要预先协调这些问题
  • 在自定义提要源中添加前缀/后缀
如果仍然需要优先级,您可以这样做,如下所示: 配置如下所示:

  <packageSources>
        <!-- Internal package source comes before NuGet.org proxy -->   
        <add key="my_private_feed" value="Feed1/" priority="1" />
        <add key="Orgnugetorg" value="https://www.nuget.org/api/v2/" priority="2" />
    </packageSources> 

希望能有帮助

我如何让nuget恢复步骤尊重myget 此包的包源

对于
nuget restore
任务,有一个选项用于控制在包还原期间使用哪些提要

请参阅要使用的源:

与本地恢复包不同,解决方案目录(Devops Repos)中的
nuget.config
文件在我们选中my nuget.config
选项中的
提要之前无法工作

因此,在这个过程中,nuget实际上没有使用
nuget.config
文件作为
包源代码,这导致了以下问题:

解决方法:

在my
Nuget.config
中配置提要,如下所示,以确保Nuget将使用解决方案目录中的
Nuget.config
文件:


此外:如果您使用的不是传统格式,您应该设置
feedsToUse:'config'
nugetConfigPath:'path/NuGet.config'

嗨,佩里,您如何在构建管道中配置NuGet还原任务?正如我所知,要使nuget.config在构建管道中工作,我们应该将
nuget.config
设置为提要,否则即使此文件位于解决方案目录中,它也无法工作。(这与本地还原有所不同。)我完全没有在还原任务中选择nuget.config文件,我认为它会自动执行。也许我不应该在睡觉前做这些事情,非常感谢