【问题标题】:TFS2017 nuget restore try to connect to nuget.orgTFS2017 nuget restore 尝试连接到 nuget.org
【发布时间】:2017-12-08 16:30:11
【问题描述】:

我有一台无法访问 Internet 的 TFS 服务器。我在 TFS 中配置了我自己的 nuget 包源,并尝试仅从该源中恢复我的解决方案包。但是当我开始 Nuget 恢复构建步骤时,nuget 尝试连接到 nuget.org 并且连接失败。我不明白如何防止这种不必要的连接尝试?

【问题讨论】:

  • 您的构建定义如何?尝试在`Nuget Restore`前添加NuGet Tool Installer任务,看看是否有效。

标签: tfs nuget


【解决方案1】:

您可以在 Nuget.Config 文件中控制 NuGet 源。在与您的解决方案文件相同的文件夹中创建一个文件“Nuget.config”。在配置文件中,您可以清除所有源并定义自己的。例如,您可以将 packageSource 设置如下

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <clear />
    <add key="ThirdParty Nuget Repository" value="http://localNuget/artifactory/api/nuget/ThirdParty" />    
  </packageSources>
</configuration>

元素将清除您现有的 Nuget 源,而 元素将为您设置一个新的本地 Nuget 源。

更多关于 Nuget 配置文件的信息可以在 https://docs.microsoft.com/en-us/nuget/schema/nuget-config-file

【讨论】:

  • 我尝试了您的解决方案,但始终有与 nuget.org 的连接...我不明白为什么...
  • 能否列出解决方案目录中的文件
【解决方案2】:

我发现了问题。事实上,我认为 NugetRestore 任务尝试连接到 nuget.org 以获取最新版本的 nuget.exe。

我绕过使用版本 0.* 的 NugetRestore 任务的问题,并指定要使用的 nuget 版本。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-02-04
    • 2021-05-06
    • 1970-01-01
    • 1970-01-01
    • 2020-07-04
    • 2021-04-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多