繁体   English   中英

Dotnet 还原为 NuGet package 提供 301 错误

[英]Dotnet restore gives 301 error for a NuGet package

我的代码昨晚运行良好,但是当我今天尝试使用dotnet restore恢复它时,出现以下错误。

Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/microsoft.aspnetcore.identity.ui/index.json'.
  Response status code does not indicate success: 301 (Moved Permanently).
  Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/fluentvalidation/index.json'.
  Response status code does not indicate success: 301 (Moved Permanently).
  Failed to download package 'Microsoft.EntityFrameworkCore.3.1.8' from 'https://api.nuget.org/v3-flatcontainer/microsoft.entityframeworkcore/3.1.8/microsoft.entityframeworkcore.3.1.8.nupkg'.
  Response status code does not indicate success: 301 (Moved Permanently).
  Failed to download package 'Microsoft.EntityFrameworkCore.3.1.1' from 'https://api.nuget.org/v3-flatcontainer/microsoft.entityframeworkcore/3.1.1/microsoft.entityframeworkcore.3.1.1.nupkg'.
  Response status code does not indicate success: 301 (Moved Permanently).
  Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/microsoft.extensions.fileproviders.embedded/index.json'.
  Response status code does not indicate success: 301 (Moved Permanently).
  Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/serilog.sinks.console/index.json'.
  Response status code does not indicate success: 301 (Moved Permanently).
  Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/system.text.regularexpressions/index.json'.
  Response status code does not indicate success: 301 (Moved Permanently).

我正在使用 Ubuntu 20.04,我的 dotnet 配置如下

.NET Core SDK (reflecting any global.json):
 Version:   3.1.414
 Commit:    88a3b0c5ca

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  20.04
 OS Platform: Linux
 RID:         ubuntu.20.04-x64
 Base Path:   /usr/share/dotnet/sdk/3.1.414/

Host (useful for support):
  Version: 3.1.20
  Commit:  2833dab8c3

.NET Core SDKs installed:
  3.1.414 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.App 3.1.20 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.20 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

但是,如果我尝试直接访问这些 URL,我可以访问它们吗? 我也在使用VPN。 会不会是因为这个?

我已经设法解决了这样的问题:

1- 从这里下载 Nuget.exe

2-将Nuget.exe添加到windows路径(可以复制到c:/windows/system32)

3-打开命令行并导航到您的解决方案文件夹并运行以下命令:

nuget.exe 恢复-DisableParallel

希望它有效。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM