【发布时间】:2017-06-20 08:51:40
【问题描述】:
我正在尝试 dotnet restore 我的 .net 核心项目,但是我无法从我当前的工作站访问 https://api.nuget.org/*(所以命令只是超时),但可以访问 http://api.nuget.org/*。
有没有办法让dotnet cli 使用 nuget.org 的 http 版本?
【问题讨论】:
标签: .net nuget nuget-package-restore dotnet-cli
我正在尝试 dotnet restore 我的 .net 核心项目,但是我无法从我当前的工作站访问 https://api.nuget.org/*(所以命令只是超时),但可以访问 http://api.nuget.org/*。
有没有办法让dotnet cli 使用 nuget.org 的 http 版本?
【问题讨论】:
标签: .net nuget nuget-package-restore dotnet-cli
您可以在您的存储库中创建一个NuGet.Config 文件(或使用dotnet new nugetconfig 创建它)并像这样添加提要:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="nuget.org" value="http://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
</configuration>
您还可以更新您的全局 NuGet.Config 文件以匹配。它位于 *nix 上的 ~/.nuget/NuGet/NuGet.Config 和 Windows 上的 %APPDATA%\NuGet\NuGet.Config。
【讨论】:
dotnet restore --configfile nuget.config 不幸的是,它似乎仍然使用https。 “对 'GET https://api.nuget.or” 的 HTTP 请求...超时 (x100)