NuGet还原无法解析主机'www.nuget'

时间:2015-05-14 20:14:33

标签: .net visual-studio-2012 nuget

我正在尝试使用nuget restore命令在CI服务器上恢复NuGet包。我可以在本地运行它没有问题,但在服务器上我收到了一些警告(错误,真的):

WARNING: The remote name could not be resolved: 'www.nuget'
WARNING: The remote name could not be resolved: 'www.nuget'
WARNING: The remote name could not be resolved: 'www.nuget'
WARNING: The remote name could not be resolved: 'www.nuget'
WARNING: The remote name could not be resolved: 'www.nuget'
WARNING: The remote name could not be resolved: 'www.nuget'
WARNING: The remote name could not be resolved: 'www.nuget'
Installing 'NSubstitute 1.8.1.0'.
Successfully installed 'NSubstitute 1.8.1.0'.
WARNING: The remote name could not be resolved: 'www.nuget'
WARNING: The remote name could not be resolved: 'www.nuget'
Unable to find version '1.7' of package 'DotSpatial.Data'.
Unable to find version '1.7' of package 'DotSpatial.Mono'.
Unable to find version '1.7' of package 'DotSpatial.Projections'.
Unable to find version '1.7' of package 'DotSpatial.Serialization'.
Unable to find version '1.7' of package 'DotSpatial.Topology'.
Unable to find version '9.1.1' of package 'JetBrains.Annotations'.
Unable to find version '1.0.0' of package 'SimpleLogger'.
Unable to find version '3.5.1' of package 'YamlDotNet'.
Unable to find version '2.0.0' of package 'NUnitTestAdapter.WithFramework'.

我可以找到(下面链接的类似问题),unable to resolve是DNS问题。 The NuGet status page显示DNS正常工作以及我可以在本地运行它而没有问题的事实似乎表明它不是NuGet服务器问题。我在两个地方都使用the command-line utility downloaded directly from the NuGet website。我已经检查过以确保没有与代理相关的环境变量干扰该过程。我在两个位置都使用Windows 7。这可能是什么问题?

类似问题:

1 个答案:

答案 0 :(得分:1)

www.nuget部分是问题 - 不是正确的远程(至少不是完整的远程名称)。这很可能是系统的配置问题,也可能是名称存储不正确的地方。检查%AppData%\NuGet\目录中的a configuration file并确保它在任何地方都有正确的远程名称。

我在%AppData%\NuGet\NuGet.config中的所作所为:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="https://www.nuget.org/api/v2/" value="https://www.nuget.org/api/v2/" />
    <add key="NuGetHttp" value="http://www.nuget/api/v2/" />
  </packageSources>
  <disabledPackageSources>
    <add key="https://www.nuget.org/api/v2/" value="true" />
  </disabledPackageSources>
</configuration>

这一行尤其不正确:

<add key="NuGetHttp" value="http://www.nuget/api/v2/" />

将值修复到上面一行,你应该好好去。

我现在拥有的:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="https://www.nuget.org/api/v2/" value="https://www.nuget.org/api/v2/" />
    <add key="NuGetHttp" value="http://www.nuget.org/api/v2/" />
  </packageSources>
  <disabledPackageSources>
    <add key="https://www.nuget.org/api/v2/" value="true" />
  </disabledPackageSources>
</configuration>

正在运行nuget restore

Installing 'DotSpatial.Mono 1.7'.
Installing 'DotSpatial.Serialization 1.7'.
Installing 'DotSpatial.Data 1.7'.
Installing 'DotSpatial.Projections 1.7'.
Successfully installed 'DotSpatial.Mono 1.7'.
Installing 'DotSpatial.Topology 1.7'.
Successfully installed 'DotSpatial.Data 1.7'.
Installing 'JetBrains.Annotations 9.1.1'.
Successfully installed 'DotSpatial.Topology 1.7'.
Installing 'SimpleLogger 1.0.0'.
Successfully installed 'JetBrains.Annotations 9.1.1'.
Successfully installed 'SimpleLogger 1.0.0'.
Successfully installed 'DotSpatial.Serialization 1.7'.
Installing 'YamlDotNet 3.5.1'.
Installing 'NSubstitute 1.8.1.0'.
Installing 'NUnitTestAdapter.WithFramework 2.0.0'.
Successfully installed 'NUnitTestAdapter.WithFramework 2.0.0'.
Successfully installed 'YamlDotNet 3.5.1'.
Successfully installed 'NSubstitute 1.8.1.0'.
Successfully installed 'DotSpatial.Projections 1.7'.